Don't crash on Sizeof of bad type.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 23 Feb 2011 05:10:05 +0000 (05:10 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 23 Feb 2011 05:10:05 +0000 (05:10 +0000)
From-SVN: r170430

gcc/go/gofrontend/expressions.cc

index 050942c619c48133f7e01548228aa36d51f64abf..e9a26a0da0d832c9b2b8809ccdb6aa1f7fc3ddd2 100644 (file)
@@ -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);