[Bug c/59017] Infinite loop introduced in program with -O2 or -O3 on Mageia Linux x86-64 Cauldron with gcc-4.8.2

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 6 11:44:00 GMT 2013


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
-fno-aggressive-loop-optimizations fixes this.  On trunk I get

t.c: In function 'main':
t.c:59:29: warning: iteration 200000u invokes undefined behavior
[-Waggressive-loop-optimizations]
         x_count += c5_counts[LIM_min_x-1]-c5_counts[x+1];
                             ^
t.c:35:5: note: containing loop
     for(int x = 0; x <= LIM; x++)
     ^

clearly x+1 is out-of bounds for x == LIM.



More information about the Gcc-bugs mailing list