[Bug middle-end/60121] gcc does not warn an obvious out-of-bound array access at -O0 and -O1
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Sun Feb 9 00:08:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60121
--- Comment #3 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Andrew Pinski from comment #2)
> I think this is expected. out of bounds warnings come not from the front-end
> but the middle-end and are designed not to warn about in dead code. This
> code is dead as a != 0 is always false.
Andrew, it's actually the complete opposite with this testcase.
At -O0 and -O1, gcc unlikely knows that the out-of-bound array access is dead,
so the warning should be issued, but it's not.
On the other hand, at -Os and above, gcc likely knows that the out-of-bound
array access is dead, but it warns.
More information about the Gcc-bugs
mailing list