Don't crash if append arguments are erroneous.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 4 Jan 2011 22:54:05 +0000 (22:54 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 4 Jan 2011 22:54:05 +0000 (22:54 +0000)
From-SVN: r168489

gcc/go/gofrontend/expressions.cc

index 840fdb37d10604b1683956da54a0c23e3ac29f5f..a7b5bbf032a7d37ea4651aa1cb6e7c74e7ca4810 100644 (file)
@@ -7965,14 +7965,14 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
        Expression* arg1 = args->front();
        Expression* arg2 = args->back();
 
-       Array_type* at = arg1->type()->array_type();
-       Type* element_type = at->element_type();
-
        tree arg1_tree = arg1->get_tree(context);
        tree arg2_tree = arg2->get_tree(context);
        if (arg1_tree == error_mark_node || arg2_tree == error_mark_node)
          return error_mark_node;
 
+       Array_type* at = arg1->type()->array_type();
+       Type* element_type = at->element_type();
+
        arg2_tree = Expression::convert_for_assignment(context, at,
                                                       arg2->type(),
                                                       arg2_tree,