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/55075] GCC optimizer makes bad assumptions on data range


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.


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