This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][2/2] Improve array-bound warnings and VRP
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Jan 2015 16:28:02 +0100 (CET)
- Subject: Re: [PATCH][2/2] Improve array-bound warnings and VRP
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1501261602400 dot 12482 at zhemvz dot fhfr dot qr> <20150126151033 dot GP1746 at tucnak dot redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1501261615390 dot 12482 at zhemvz dot fhfr dot qr> <20150126152337 dot GQ1746 at tucnak dot redhat dot com>
On Mon, 26 Jan 2015, Jakub Jelinek wrote:
> On Mon, Jan 26, 2015 at 04:18:32PM +0100, Richard Biener wrote:
> > > > Ok for trunk? Or should I delay this to GCC 6?
> > >
> > > Does this work even without the other patch?
> >
> > Yes, I've actually developed 2/2 first. The other patch only ever
> > emits more warnings...
>
> Then it probably should be ok. I'm really afraid of emitting more warnings
> with such high false positive rate now.
>
> > > What do you think about Ilya's patch to set TREE_NO_WARNING in the unrolled
> > > iterations where we had to keep the exit check?
> >
> > I don't like it too much - it papers over the real issue and prevents
> > valid warnings from being emitted. Maybe we can set TREE_NO_WARNING on
> > the last iteration (that is the only one we usually end up warning
> > on - like after this patch). There are also many dups - regressions
> > in 4.8 I belive where we warn for the last iteration in an unrolled loop.
>
> Do we check only the last iteration? Won't we warn about other iterations
> too? -Warray-bounds have plenty of warnings in dead jump threaded code that
> the compiler can't prove is dead etc.
Sure - but for unrolling
int a[2];
for (int i = 0; i < 5; i++)
a[i] = i;
I'd like to see warnings and we only warn if we unroll this because
the value-range of i includes indexes that are valid.
> IMHO the warning should be done in VRP1 only.
Yeah, I agree - but I remember that people wanted the extra stuff
from VRP2 (just quickly checked that gcc.dg/Warray-bounds* doesn't
regress with disabling VRP2).
So - do we want to disable array bound warnings for VRP2? I'd be
happy to approve of that and it will most certainly fix all of the
recent (4.8+) regressions related to loop peeling.
Thanks,
Richard.