From f315816c37c235b0f99593080501c2e3855c3568 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 23 Feb 2011 05:10:05 +0000 Subject: Don't crash on Sizeof of bad type. From-SVN: r170430 --- gcc/go/gofrontend/expressions.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 050942c..e9a26a0 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -7980,7 +7980,11 @@ Builtin_call_expression::do_get_tree(Translate_context* context) mpz_init(val); Type* dummy; bool b = this->integer_constant_value(true, val, &dummy); - gcc_assert(b); + if (!b) + { + gcc_assert(saw_errors()); + return error_mark_node; + } tree type = Type::lookup_integer_type("int")->get_tree(gogo); tree ret = Expression::integer_constant_tree(val, type); mpz_clear(val); -- cgit v1.1