[Bug rtl-optimization/45223] RTL PRE GCSE pass hoists trapping insn out of loop

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 7 08:40:00 GMT 2010



------- Comment #2 from ubizjak at gmail dot com  2010-08-07 08:40 -------
Ugh, with a bit changed testcase:

--cut here--
extern void exit (int);
extern void abort (void);

volatile float a = 1;
volatile float b = 0;
volatile int x = 2;
volatile signed int r = 8;

void __attribute__((noinline))
foo (void)
{
  exit (0);
}

int
main (void)
{
  float si1 = a;
  float si2 = b;
  int i;

  for (i = 0; i < 100; ++i) {
      foo ();
      if (x == 8)
        i++;
      r += i + (int) (si1 / si2);
  }
  abort ();
}
--cut here--

-O2 on x86_64-pc-linux-gnu:

main:
        pushq   %rbx
        xorl    %ebx, %ebx
        subq    $16, %rsp
        movss   a(%rip), %xmm0
        movss   %xmm0, 12(%rsp)
        movss   b(%rip), %xmm0
        movss   12(%rsp), %xmm1
>	divss	%xmm0, %xmm1
        movss   %xmm1, 12(%rsp)
.L4:
        call    foo
        ...

I hope that Ariane-5 is safe [1] ;)

[1] http://en.wikipedia.org/wiki/Ariane_5_Flight_501


-- 


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



More information about the Gcc-bugs mailing list