On Mon, Jan 26, 2015 at 03:57:20PM +0100, Richard Biener wrote: > > I've looked at PR64277 and noticed we haven't been applying TLC to the > array-bound warning code for a long time. I noticed we don't > warn for out-of-bound return &a[11]; - fixed with the simplifications. > I also noticed that anti-range handling has off-by-one errors > (well, always applied ignore_off_by_one and to both ends of the array). > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu. > > It doesn't help the testcase in PR64277 ([2/2] will somewhat). > > Ok for trunk? (seems we never warned for returning &a[11] and > anti-range handling was broken all the time) > > I can as well queue this for GCC 6.
I think for this warning which is notorious for generating false positives everywhere it would be better to defer to GCC 6 at this point. > 2015-01-26 Richard Biener <rguent...@suse.de> > > PR tree-optimization/64277 > * tree-vrp.c (check_array_ref): Fix anti-range handling, > simplify upper bound handling. > (search_for_addr_array): Simplify. > (check_array_bounds): Handle ADDR_EXPRs here. > (check_all_array_refs): Simplify. > > * gcc.dg/Warray-bounds-12.c: New testcase. > * gcc.dg/Warray-bounds-13.c: Likewise. Jakub