From 856f6235bdd0963918a0525b9a0e51386e5aa141 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 15 May 2012 20:00:57 +0000 Subject: [PATCH] compiler: Don't try to take the address of a constant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@187554 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/expressions.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index f6fb65866f0..56df6f66b70 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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); -- 2.11.0