[Bug middle-end/50802] [4.7 Regression] FAIL: gcc.c-torture/execute/arith-rand-ll.c execution at -O2 and -Os

danglin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Oct 23 19:54:00 GMT 2011


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

--- Comment #1 from John David Anglin <danglin at gcc dot gnu.org> 2011-10-23 19:54:21 UTC ---
The abort occurs in this block:

      { signed char xx = x, yy = y, r1, r2;
        r1 = xx / yy;
        r2 = xx % yy;
        if (ABS (r2) >= (unsigned char) ABS (yy) || (signed char) (r1 * yy +
r2) != xx)
          abort ();
      }

for i = 2.

The test doesn't fail if I simply reduce the testcase to the above
and add a check for yy = 0.  My impression is the above fails because
the it is using r1 and r2 values from this block:

      { signed short xx = x, yy = y, r1, r2;        r1 = xx / yy;
        r2 = xx % yy;
        if (ABS (r2) >= (unsigned short) ABS (yy) || (signed short) (r1 * yy +
r
2) != xx)
          abort ();
      }

These are the values that cause the abort:

(gdb) p/x x
$79 = 0x1f801ff80ffff
(gdb) p/x y
$80 = 0x7f8007ffff8007ff
(gdb) p/x xx
$81 = 0xff
(gdb) p/x yy
$82 = 0xff
(gdb) p/x r2
$83 = 0xff
(gdb) p/x r1
$84 = 0x0

The r2 value is wrong.



More information about the Gcc-bugs mailing list