diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-15 20:00:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-15 20:00:39 +0000 |
commit | ae10b5747364804809ed196a7bf41dbb3de83fdc (patch) | |
tree | eee46a48d607d1db8b1d44cf56744f936df1e5d8 /gcc/go | |
parent | f2437399519faee351b24beae127c0f4310aa13c (diff) | |
download | gcc-ae10b5747364804809ed196a7bf41dbb3de83fdc.zip gcc-ae10b5747364804809ed196a7bf41dbb3de83fdc.tar.gz gcc-ae10b5747364804809ed196a7bf41dbb3de83fdc.tar.bz2 |
compiler: Don't try to take the address of a constant.
From-SVN: r187553
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index f6fb658..56df6f6 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); |