summaryrefslogtreecommitdiffstats
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 304a20b1082..53cf1feac32 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3576,7 +3576,14 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
break;
case CONST_DECL:
- *expr_p = DECL_INITIAL (*expr_p);
+ /* If we require an lvalue, such as for ADDR_EXPR, retain the
+ CONST_DECL node. Otherwise the decl is replacable by its
+ value. */
+ /* ??? Should be == fb_lvalue, but ADDR_EXPR passes fb_either. */
+ if (fallback & fb_lvalue)
+ ret = GS_ALL_DONE;
+ else
+ *expr_p = DECL_INITIAL (*expr_p);
break;
case DECL_EXPR:
OpenPOWER on IntegriCloud