This testcase causes an ICE at -O2:

void foo (volatile long long *x)
{
  while (*x)
    {
      *x = 0;
      *((volatile char *) 0) = 0;
    }
}

with:

 error: unrecognizable insn:
(insn:HI 25 21 27 2 (set (mem/v:QI (subreg:SI (reg:DI 124) 4) [0 S1 A8])
        (subreg:QI (reg:DI 124) 7)) -1 (nil)
    (expr_list:REG_EQUAL (const_int 0 [0x0])
        (nil)))

The bug is in the loop,c movables code.  There are two loop-invariant
registers with the value 0, one SImode and one DImode.  loop decides
to combine them and replaces uses of the SImode register with the DImode
one.  This turns the address in the MEM from an SImode REG to an
SImode SUBREG of a DImode reg, and powerpc's GO_IF_LEGITIMATE_ADDRESS
doesn't allow that.

-- 
           Summary: Loop optimisation ICE for subreg addresses
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: rsandifo at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23233

Reply via email to