[Bug tree-optimization/55075] GCC optimizer makes bad assumptions on data range

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 25 21:24:00 GMT 2012


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-10-25 21:24:42 UTC ---
I don't see any problem with the warning (that turned into an error).

>As a result, in the attached example, it raises a compile error.

Yes because if GCC does not know the value of x at the start of main (well it
could but does not current).

After the if statement, GCC can assume x>0 which means it should warn about the
above array access.

Why do you think it cannot?

>however, it is suspected that it may produce bad code in certain circumstances.

How so the array is of size 1 and x>0 as defined by the if statement and it
does not know the upper bound of x.



More information about the Gcc-bugs mailing list