diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-03 00:42:10 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-03 00:42:10 +0000 |
commit | 8ca93ccfd2f266eaca01dc053bee934a6b0fb24e (patch) | |
tree | 648d7125288f81395721907f461c72db6b8b9f9e /gcc | |
parent | b58219c16d0ce31d7b8c8e481afcdffed889575d (diff) | |
download | gcc-8ca93ccfd2f266eaca01dc053bee934a6b0fb24e.zip gcc-8ca93ccfd2f266eaca01dc053bee934a6b0fb24e.tar.gz gcc-8ca93ccfd2f266eaca01dc053bee934a6b0fb24e.tar.bz2 |
Don't crash if a constant has a declared but undefined type.
From-SVN: r170632
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/gogo-tree.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index 722a23a..883b5b1 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -926,7 +926,16 @@ Named_object::get_tree(Gogo* gogo, Named_object* function) { Type* type = named_constant->type(); if (type != NULL && !type->is_abstract()) - expr_tree = fold_convert(type->get_tree(gogo), expr_tree); + { + if (!type->is_undefined()) + expr_tree = fold_convert(type->get_tree(gogo), expr_tree); + else + { + // Make sure we report the error. + type->base(); + expr_tree = error_mark_node; + } + } if (expr_tree == error_mark_node) decl = error_mark_node; else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree))) |