This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/58731] wrong code (hangs) at -O3 on x86_64-linux-gnu


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-15
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
int a, b, c, d, e;

int
main ()
{
  for (b = 4; b > -30; b--)
    for (; c;)
      for (;;)
    {
      e = a > 2147483647 - b;

the issue here is that PRE (and LIM) move 2147483647 - b outside the
for (;c;) loop entry test and thus make it always execute in the
outermost loop, triggering the undefined behavior at iteration 5.
Also warns at -O1 with -fstrict-overflow.

PR58134 and PR58227 are related (if not dups).


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