aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-07 10:22:51 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-07 10:22:51 +0100
commitb1b95093addde97a78ec59fef4c6930847f84566 (patch)
treeaac8ca8d6fe1e3814662159ee79805a344b6686f /gcc/expr.c
parentb59cbd503473a38ddc09ed69f36ff534eaa88d11 (diff)
downloadgcc-b1b95093addde97a78ec59fef4c6930847f84566.zip
gcc-b1b95093addde97a78ec59fef4c6930847f84566.tar.gz
gcc-b1b95093addde97a78ec59fef4c6930847f84566.tar.bz2
re PR middle-end/52074 (ICE: RTL flag check: MEM_VOLATILE_P used with unexpected rtx code 'plus' in extract_fixed_bit_field, at expmed.c:1734)
PR middle-end/52074 * expr.c (expand_expr_addr_expr_1): For CONSTANT_CLASS_P or CONST_DECL if modifier < EXPAND_SUM call force_operand on the result. * gcc.c-torture/compile/pr52074.c: New test. From-SVN: r183956
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index ff88fcd..fcf177b 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7414,7 +7414,12 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
generating ADDR_EXPR of something that isn't an LVALUE. The only
exception here is STRING_CST. */
if (CONSTANT_CLASS_P (exp))
- return XEXP (expand_expr_constant (exp, 0, modifier), 0);
+ {
+ result = XEXP (expand_expr_constant (exp, 0, modifier), 0);
+ if (modifier < EXPAND_SUM)
+ result = force_operand (result, target);
+ return result;
+ }
/* Everything must be something allowed by is_gimple_addressable. */
switch (TREE_CODE (exp))
@@ -7433,7 +7438,11 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
case CONST_DECL:
/* Expand the initializer like constants above. */
- return XEXP (expand_expr_constant (DECL_INITIAL (exp), 0, modifier), 0);
+ result = XEXP (expand_expr_constant (DECL_INITIAL (exp),
+ 0, modifier), 0);
+ if (modifier < EXPAND_SUM)
+ result = force_operand (result, target);
+ return result;
case REALPART_EXPR:
/* The real part of the complex number is always first, therefore