From: Eric Botcazou Date: Mon, 7 Oct 2002 07:37:12 +0000 (+0200) Subject: re PR c/7411 (cistore.c:392: Internal compiler error in instantiate_virtual_regs_1... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4ef7870a4d8aacd145bdbde7ae914f500bf13b56;p=gcc.git re PR c/7411 (cistore.c:392: Internal compiler error in instantiate_virtual_regs_1, at function.c:3974) PR c/7411 * expr.c (expand_expr) [PLUS]: Simplify after the operands have been expanded in EXPAND_NORMAL mode. Co-Authored-By: Volker Reichelt From-SVN: r57882 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b31645380c0..47717e7d997 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-09-25 Eric Botcazou + Volker Reichelt + + PR c/7411 + * expr.c (expand_expr) [PLUS]: Simplify after the operands + have been expanded in EXPAND_NORMAL mode. + 2002-10-06 Richard Henderson * config/rs6000/rs6000.md (load_toc_v4_PIC_2): Fix base constraint. diff --git a/gcc/expr.c b/gcc/expr.c index 01c360315b8..e33d8145e1f 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -7899,16 +7899,23 @@ expand_expr (exp, target, tmode, modifier) } } + if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1)) + subtarget = 0; + /* No sense saving up arithmetic to be done if it's all in the wrong mode to form part of an address. And force_operand won't know whether to sign-extend or zero-extend. */ if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER) || mode != ptr_mode) - goto binop; - - if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1)) - subtarget = 0; + { + op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0); + op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0); + temp = simplify_binary_operation (PLUS, mode, op0, op1); + if (temp) + return temp; + goto binop2; + } op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier); op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier); diff --git a/gcc/testsuite/gcc.c-torture/compile/20021007-1.c b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c new file mode 100644 index 00000000000..de4c0defae9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20021007-1.c @@ -0,0 +1,11 @@ +/* PR c/7411 */ +/* Verify that GCC simplifies the null addition to i before + virtual register substitution tries it and winds up with + a memory to memory move. */ + +void foo () +{ + int i = 0,j; + + i+=j=0; +}