]> gcc.gnu.org Git - gcc.git/commitdiff
compiler: Don't try to take the address of a constant.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 15 May 2012 20:00:39 +0000 (20:00 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 15 May 2012 20:00:39 +0000 (20:00 +0000)
From-SVN: r187553

gcc/go/gofrontend/expressions.cc

index f6fb65866f00e5441713fdf50da03f3a680e1c5a..56df6f66b70c27584c6941f1986ceec353294d99 100644 (file)
@@ -4044,7 +4044,7 @@ Unary_expression::do_get_tree(Translate_context* context)
 
       if (this->create_temp_
          && !TREE_ADDRESSABLE(TREE_TYPE(expr))
-         && !DECL_P(expr)
+         && (TREE_CODE(expr) == CONST_DECL || !DECL_P(expr))
          && TREE_CODE(expr) != INDIRECT_REF
          && TREE_CODE(expr) != COMPONENT_REF)
        {
@@ -6194,7 +6194,9 @@ Expression::comparison_tree(Translate_context* context, Operator op,
          make_tmp = NULL_TREE;
          arg = right_tree;
        }
-      else if (TREE_ADDRESSABLE(TREE_TYPE(right_tree)) || DECL_P(right_tree))
+      else if (TREE_ADDRESSABLE(TREE_TYPE(right_tree))
+              || (TREE_CODE(right_tree) != CONST_DECL
+                  && DECL_P(right_tree)))
        {
          make_tmp = NULL_TREE;
          arg = build_fold_addr_expr_loc(location.gcc_location(), right_tree);
This page took 0.083363 seconds and 5 git commands to generate.