This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix PR c/7411


Hello,

The compiler ICEs in instantiate_virtual_regs_1 on this insn:

(insn 11 10 12 (nil) (parallel [
            (set (mem/f:SI (plus:SI (reg/f:SI 54 virtual-stack-vars)
                        (const_int -4 [0xfffffffc])) [0 i+0 S4 A32])
                (plus:SI (mem/f:SI (plus:SI (reg/f:SI 54 virtual-stack-vars)
                            (const_int -4 [0xfffffffc])) [0 i+0 S4 A32])
                    (const_int 0 [0x0])))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil)
    (nil))

because the recognizer chokes on the (plus (mem) (const_int 0)) pattern.

The (const_int 0) is not folded at the tree level because the ST for

  i+=j=0;

is:  MODIFY_EXPR
      /      \
     i      PLUS_EXPR
            /     \
           i   MODIFY_EXPR
               /       \
              j         0


The proposed fix is to let expand_expr simplify the PLUS operation
after it has expanded its operands.

Bootstrapped/regtested (C/C++) on i586-pc-linux-gnu. Thanks (again!)
to Volker Reichelt for distilling a testcase that has roughly 0.1% of
the complexity of the original one :-)


2002-09-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
            Volker Reichelt <reichelt@igpm.rwth-aachen.de>

 PR c/7411
 * expr.c (expand_expr) [PLUS]: Simplify after the operands
 have been expanded in EXPAND_NORMAL mode.


/* PR c/7411 */
/* Verify that GCC simplifies the null
   addition to i during RTL generation.  */

void foo ()
{
   int i = 0,j;

   i+=j=0;
}


--
Eric Botcazou

Attachment: pr7411.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]