This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/55075] GCC optimizer makes bad assumptions on data range
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 25 Oct 2012 21:24:42 +0000
- Subject: [Bug tree-optimization/55075] GCC optimizer makes bad assumptions on data range
- Auto-submitted: auto-generated
- References: <bug-55075-4@http.gcc.gnu.org/bugzilla/>
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.