aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-07-30 15:55:30 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-07-30 15:55:30 -0700
commit0534fa565255cf56d5771ea92522403947d4bbd4 (patch)
treeb8e5fa782f1cf0143b461a419b9a4855d6b9c559 /gcc/gimplify.c
parent782700d4f2d37e2ee883594032d6748aef983165 (diff)
downloadgcc-0534fa565255cf56d5771ea92522403947d4bbd4.zip
gcc-0534fa565255cf56d5771ea92522403947d4bbd4.tar.gz
gcc-0534fa565255cf56d5771ea92522403947d4bbd4.tar.bz2
gimplify.c (gimplify_expr): Don't replace with DECL_INITIAL if fb_lvalue.
* gimplify.c (gimplify_expr) <case CONST_DECL>: Don't replace with DECL_INITIAL if fb_lvalue. * tree-gimple.c (is_gimple_id): Add CONST_DECL. * tree-pretty-print.c (dump_decl_name): Dump unnamed CONST_DECL with <Cxxx>. * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Fold CONST_DECL. fortran/ * trans-expr.c (gfc_conv_expr_reference): Create a CONST_DECL for TREE_CONSTANTs. testsuite/ * gfortran.fortran-torture/execute/intrinsic_rrspacing.f90: Fix write to constant argument. * gfortran.fortran-torture/execute/intrinsic_scale.f90: Likewise. From-SVN: r85365
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 304a20b..53cf1fe 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: