Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-14 Thread Jeff Law
On 11/13/2017 06:21 PM, Martin Sebor wrote: > I have a different concern with the general idea of moving these > kinds of warnings into passes of their own.  It would unavoidably > result in duplicating some code from the optimization passes (at > a minimum, the GIMPLE traversal, but likely more th

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-14 Thread Jeff Law
On 11/14/2017 01:42 AM, Richard Biener wrote: > > I suspect once you're dealing with C++ code you run into the issue > that even early inlining exposes code with forwprop run on it > before running forwprop again on the inlined-into body. > > So the IPA issues start very early. Of course if you

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-14 Thread Richard Biener
On Mon, 13 Nov 2017, Martin Sebor wrote: > On 11/10/2017 01:00 AM, Richard Biener wrote: > > On Thu, 9 Nov 2017, Jeff Law wrote: > > > > > On 11/02/2017 05:48 AM, Richard Biener wrote: > > > > > > > > > > > There were elaborate transforms of ptr + CST to ptr->a.b.c[3] in the > > > > past. We h

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-14 Thread Richard Biener
On Mon, 13 Nov 2017, Jeff Law wrote: > On 11/10/2017 01:00 AM, Richard Biener wrote: > > > > It's the usual issue with an optimizing compiler vs. a static analyzer. > > We try to get rid of the little semantic details of the input languages > > that in the end do not matter for code-generation bu

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-13 Thread Martin Sebor
On 11/10/2017 01:00 AM, Richard Biener wrote: On Thu, 9 Nov 2017, Jeff Law wrote: On 11/02/2017 05:48 AM, Richard Biener wrote: There were elaborate transforms of ptr + CST to ptr->a.b.c[3] in the past. We have ripped out _most_ of them because of bad interaction with dependence analysis an

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-13 Thread Jeff Law
On 11/10/2017 01:00 AM, Richard Biener wrote: > > It's the usual issue with an optimizing compiler vs. a static analyzer. > We try to get rid of the little semantic details of the input languages > that in the end do not matter for code-generation but that makes > using those semantic details hard

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-10 Thread Richard Biener
On Thu, 9 Nov 2017, Jeff Law wrote: > On 11/02/2017 05:48 AM, Richard Biener wrote: > > > > > There were elaborate transforms of ptr + CST to ptr->a.b.c[3] in the > > past. We have ripped out _most_ of them because of bad interaction > > with dependence analysis and _b_o_s warnings. > > > > Bu

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-09 Thread Jeff Law
On 11/02/2017 05:48 AM, Richard Biener wrote: > > There were elaborate transforms of ptr + CST to ptr->a.b.c[3] in the > past. We have ripped out _most_ of them because of bad interaction > with dependence analysis and _b_o_s warnings. > > But for example PRE might still end up propagating > >

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-02 Thread Richard Biener
On Mon, 30 Oct 2017, Martin Sebor wrote: > On 10/30/2017 02:56 PM, Richard Biener wrote: > > On October 30, 2017 9:13:04 PM GMT+01:00, Martin Sebor > > wrote: > > > On 10/30/2017 01:53 PM, Richard Biener wrote: > > > > On October 30, 2017 4:19:25 PM GMT+01:00, Martin Sebor > > > wrote: > > > > >

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-02 Thread Richard Biener
On Mon, 30 Oct 2017, Jeff Law wrote: > On 10/30/2017 05:29 PM, Martin Sebor wrote: > > On 10/30/2017 03:48 PM, Jeff Law wrote: > >> On 10/30/2017 09:19 AM, Martin Sebor wrote: > >>> On 10/30/2017 05:45 AM, Richard Biener wrote: > On Sun, 29 Oct 2017, Martin Sebor wrote: > > > In my w

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-11-01 Thread Martin Sebor
I of course don't want to break anything.  I didn't see any fallout in my testing and I normally test all the front ends, including Ada, but let me check to make sure I tested it this time (I had made some temporary changes to my build script and may have disabled it.)  Let me double check it afte

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Jeff Law
On 10/30/2017 05:29 PM, Martin Sebor wrote: > On 10/30/2017 03:48 PM, Jeff Law wrote: >> On 10/30/2017 09:19 AM, Martin Sebor wrote: >>> On 10/30/2017 05:45 AM, Richard Biener wrote: On Sun, 29 Oct 2017, Martin Sebor wrote: > In my work on -Wrestrict, to issue meaningful warnings, I f

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Martin Sebor
On 10/30/2017 03:48 PM, Jeff Law wrote: On 10/30/2017 09:19 AM, Martin Sebor wrote: On 10/30/2017 05:45 AM, Richard Biener wrote: On Sun, 29 Oct 2017, Martin Sebor wrote: In my work on -Wrestrict, to issue meaningful warnings, I found it important to detect both out of bounds array indices as

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Jeff Law
On 10/29/2017 10:01 AM, Martin Sebor wrote: > In my work on -Wrestrict, to issue meaningful warnings, I found > it important to detect both out of bounds array indices as well > as offsets in calls to restrict-qualified functions like strcpy. > GCC already detects some of these cases but my tests f

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Jeff Law
On 10/30/2017 09:19 AM, Martin Sebor wrote: > On 10/30/2017 05:45 AM, Richard Biener wrote: >> On Sun, 29 Oct 2017, Martin Sebor wrote: >> >>> In my work on -Wrestrict, to issue meaningful warnings, I found >>> it important to detect both out of bounds array indices as well >>> as offsets in calls

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Martin Sebor
On 10/30/2017 02:56 PM, Richard Biener wrote: On October 30, 2017 9:13:04 PM GMT+01:00, Martin Sebor wrote: On 10/30/2017 01:53 PM, Richard Biener wrote: On October 30, 2017 4:19:25 PM GMT+01:00, Martin Sebor wrote: On 10/30/2017 05:45 AM, Richard Biener wrote: On Sun, 29 Oct 2017, Martin

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Richard Biener
On October 30, 2017 9:13:04 PM GMT+01:00, Martin Sebor wrote: >On 10/30/2017 01:53 PM, Richard Biener wrote: >> On October 30, 2017 4:19:25 PM GMT+01:00, Martin Sebor > wrote: >>> On 10/30/2017 05:45 AM, Richard Biener wrote: On Sun, 29 Oct 2017, Martin Sebor wrote: > In my work on -

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Martin Sebor
On 10/30/2017 01:53 PM, Richard Biener wrote: On October 30, 2017 4:19:25 PM GMT+01:00, Martin Sebor wrote: On 10/30/2017 05:45 AM, Richard Biener wrote: On Sun, 29 Oct 2017, Martin Sebor wrote: In my work on -Wrestrict, to issue meaningful warnings, I found it important to detect both out o

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Richard Biener
On October 30, 2017 4:19:25 PM GMT+01:00, Martin Sebor wrote: >On 10/30/2017 05:45 AM, Richard Biener wrote: >> On Sun, 29 Oct 2017, Martin Sebor wrote: >> >>> In my work on -Wrestrict, to issue meaningful warnings, I found >>> it important to detect both out of bounds array indices as well >>> a

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Martin Sebor
On 10/30/2017 05:45 AM, Richard Biener wrote: On Sun, 29 Oct 2017, Martin Sebor wrote: In my work on -Wrestrict, to issue meaningful warnings, I found it important to detect both out of bounds array indices as well as offsets in calls to restrict-qualified functions like strcpy. GCC already det

Re: [PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-30 Thread Richard Biener
On Sun, 29 Oct 2017, Martin Sebor wrote: > In my work on -Wrestrict, to issue meaningful warnings, I found > it important to detect both out of bounds array indices as well > as offsets in calls to restrict-qualified functions like strcpy. > GCC already detects some of these cases but my tests for

[PATCH] enhance -Warray-bounds to detect out-of-bounds offsets (PR 82455)

2017-10-29 Thread Martin Sebor
In my work on -Wrestrict, to issue meaningful warnings, I found it important to detect both out of bounds array indices as well as offsets in calls to restrict-qualified functions like strcpy. GCC already detects some of these cases but my tests for the enhanced warning exposed a few gaps. The at