compiler: Don't crash on array assignment.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 8 Mar 2012 01:38:55 +0000 (01:38 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 8 Mar 2012 01:38:55 +0000 (01:38 +0000)
From-SVN: r185092

gcc/go/gofrontend/expressions.cc

index a2097e002eb078eeb4b06c6bdf4465861e05468d..134b5ae2aae7134a494cc42a85bc9d06d5ab5065 100644 (file)
@@ -284,8 +284,10 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
           || SCALAR_FLOAT_TYPE_P(lhs_type_tree)
           || COMPLEX_FLOAT_TYPE_P(lhs_type_tree))
     return fold_convert_loc(location.gcc_location(), lhs_type_tree, rhs_tree);
-  else if (TREE_CODE(lhs_type_tree) == RECORD_TYPE
-          && TREE_CODE(TREE_TYPE(rhs_tree)) == RECORD_TYPE)
+  else if ((TREE_CODE(lhs_type_tree) == RECORD_TYPE
+           && TREE_CODE(TREE_TYPE(rhs_tree)) == RECORD_TYPE)
+          || (TREE_CODE(lhs_type_tree) == ARRAY_TYPE
+              && TREE_CODE(TREE_TYPE(rhs_tree)) == ARRAY_TYPE))
     {
       // This conversion must be permitted by Go, or we wouldn't have
       // gotten here.