Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2018-01-08 Thread Tom de Vries
On 12/17/2017 01:01 AM, Martin Sebor wrote: * c-c++-common/Wrestrict.c: New test. 681/* The following doesn't overlap but it should trigger -Wstrinop-ovewrflow 682 for writing past the end. */ 683T ("012", a + sizeof a, a); For nvptx, the warning actually

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-17 Thread H.J. Lu
On Sat, Dec 16, 2017 at 4:01 PM, Martin Sebor wrote: > On 12/11/2017 03:27 PM, Jeff Law wrote: >> >> On 12/08/2017 12:19 PM, Martin Sebor wrote: >>> >>> Attached is revision 8 of the patch with the changes suggested >>> and/or requested below. >> >> >> [ Big snip. ] >> >>> >>>

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-11 Thread Jeff Law
On 12/08/2017 12:19 PM, Martin Sebor wrote: > Attached is revision 8 of the patch with the changes suggested > and/or requested below. [ Big snip. ] > > > gcc-78918.diff > > > PR tree-optimization/78918 - missing -Wrestrict on memcpy copying over self > > gcc/c-family/ChangeLog: > >

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Martin Sebor
On 12/07/2017 03:23 PM, Jeff Law wrote: On 11/29/2017 04:36 PM, Martin Sebor wrote: I've finished reimplementing the patch as a standalone pass. In the attached revision I also addressed your comments below as well as Richard's to allowing the strlen optimizations even for overlapping accesses.

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Jeff Law
On 11/29/2017 04:36 PM, Martin Sebor wrote: > I've finished reimplementing the patch as a standalone pass. > In the attached revision I also addressed your comments below > as well as Richard's to allowing the strlen optimizations even > for overlapping accesses. > > While beefing up the tests I 

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Jeff Law
On 12/07/2017 02:28 PM, Martin Sebor wrote: > On 12/07/2017 02:14 PM, Jeff Law wrote: >> On 11/29/2017 04:36 PM, Martin Sebor wrote: >>> I've finished reimplementing the patch as a standalone pass. >>> In the attached revision I also addressed your comments below >>> as well as Richard's to

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Martin Sebor
On 12/07/2017 02:14 PM, Jeff Law wrote: On 11/29/2017 04:36 PM, Martin Sebor wrote: I've finished reimplementing the patch as a standalone pass. In the attached revision I also addressed your comments below as well as Richard's to allowing the strlen optimizations even for overlapping accesses.

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Jeff Law
On 11/29/2017 04:36 PM, Martin Sebor wrote: > I've finished reimplementing the patch as a standalone pass. > In the attached revision I also addressed your comments below > as well as Richard's to allowing the strlen optimizations even > for overlapping accesses. > > While beefing up the tests I 

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Jeff Law
On 11/27/2017 05:44 AM, Richard Biener wrote: > > + > + if (const strinfo *chksi = olddsi ? olddsi : dsi) > +if (si > + && !check_bounds_or_overlap (stmt, chksi->ptr, si->ptr, NULL_TREE, > len)) > + /* Avoid transforming strcpy when out-of-bounds offsets or > +overlapping

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-12-07 Thread Jeff Law
On 11/25/2017 05:53 PM, Martin Sebor wrote: > On 11/22/2017 04:50 PM, Jeff Law wrote: >> On 11/16/2017 02:29 PM, Martin Sebor wrote: On 10/23/2017 08:42 PM, Martin Sebor wrote: > Attached is a reworked solution to enhance -Wrestrict while > avoiding changing tree-vrp.c or any other

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-11-29 Thread Martin Sebor
On 11/27/2017 05:44 AM, Richard Biener wrote: On Thu, Nov 16, 2017 at 10:29 PM, Martin Sebor wrote: Ping. I've fixed the outstanding false positive exposed by the Linux kernel. The kernel builds with four instances of the warning, all of them valid (perfect overlap in

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-11-27 Thread Richard Biener
On Thu, Nov 16, 2017 at 10:29 PM, Martin Sebor wrote: > Ping. > > I've fixed the outstanding false positive exposed by the Linux > kernel. The kernel builds with four instances of the warning, > all of them valid (perfect overlap in memcpy). > > I also built Glibc. It shows

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-11-25 Thread Martin Sebor
On 11/22/2017 04:50 PM, Jeff Law wrote: On 11/16/2017 02:29 PM, Martin Sebor wrote: Ping. I've fixed the outstanding false positive exposed by the Linux kernel. The kernel builds with four instances of the warning, all of them valid (perfect overlap in memcpy). I also built Glibc. It shows

Re: [PING 2][PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-11-22 Thread Jeff Law
On 11/16/2017 02:29 PM, Martin Sebor wrote: > Ping. > > I've fixed the outstanding false positive exposed by the Linux > kernel.  The kernel builds with four instances of the warning, > all of them valid (perfect overlap in memcpy). > > I also built Glibc.  It shows one instance of the warning, 

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-09-01 Thread Jeff Law
On 08/28/2017 06:27 PM, Martin Sebor wrote: >> Correct. I wound my way through this mess a while back. Essentially >> Red Hat had a customer with code that had overlapped memcpy arguments. >> We had them use the memstomp interposition library to start tracking >> these problems down. >> >> One

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-31 Thread Jeff Law
On 08/28/2017 06:20 PM, Martin Sebor wrote: >> >> Warning for memcpy (p, p, ...) is going to fire false positives all >> around >> given the C++ FE emits those in some cases and optimization can >> expose that we are dealing with self-assignments. And *p = *p is >> valid. > > I changed it to

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-29 Thread Richard Biener
On Tue, Aug 29, 2017 at 2:20 AM, Martin Sebor wrote: > On 08/22/2017 02:45 AM, Richard Biener wrote: >> >> On Mon, Aug 21, 2017 at 10:10 PM, Martin Sebor wrote: >>> >>> On 08/09/2017 10:14 AM, Jeff Law wrote: On 08/06/2017 05:08 PM, Martin Sebor

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-28 Thread Martin Sebor
On 08/24/2017 04:09 PM, Jeff Law wrote: On 08/22/2017 02:45 AM, Richard Biener wrote: On Mon, Aug 21, 2017 at 10:10 PM, Martin Sebor wrote: On 08/09/2017 10:14 AM, Jeff Law wrote: On 08/06/2017 05:08 PM, Martin Sebor wrote: Well, simply because the way as implemented

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-28 Thread Martin Sebor
On 08/22/2017 02:45 AM, Richard Biener wrote: On Mon, Aug 21, 2017 at 10:10 PM, Martin Sebor wrote: On 08/09/2017 10:14 AM, Jeff Law wrote: On 08/06/2017 05:08 PM, Martin Sebor wrote: Well, simply because the way as implemented isn't a must-alias query but maybe one

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-24 Thread Jeff Law
On 08/22/2017 02:45 AM, Richard Biener wrote: > On Mon, Aug 21, 2017 at 10:10 PM, Martin Sebor wrote: >> On 08/09/2017 10:14 AM, Jeff Law wrote: >>> >>> On 08/06/2017 05:08 PM, Martin Sebor wrote: >>> > > Well, simply because the way as implemented isn't a must-alias

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-22 Thread Richard Biener
On Mon, Aug 21, 2017 at 10:10 PM, Martin Sebor wrote: > On 08/09/2017 10:14 AM, Jeff Law wrote: >> >> On 08/06/2017 05:08 PM, Martin Sebor wrote: >> Well, simply because the way as implemented isn't a must-alias query but maybe one that's good enough for warnings

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-21 Thread Martin Sebor
On 08/09/2017 10:14 AM, Jeff Law wrote: On 08/06/2017 05:08 PM, Martin Sebor wrote: Well, simply because the way as implemented isn't a must-alias query but maybe one that's good enough for warnings (reduces false positives but surely doesn't eliminate them). I'm very interested in reducing

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-09 Thread Jeff Law
On 08/06/2017 05:08 PM, Martin Sebor wrote: >> >> Well, simply because the way as implemented isn't a must-alias query >> but maybe one that's good enough for warnings (reduces false positives >> but surely doesn't eliminate them). > > I'm very interested in reducing the rate of false positives

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-09 Thread Jeff Law
On 08/03/2017 02:45 AM, Richard Biener wrote: > > Well, simply because the way as implemented isn't a must-alias query > but maybe one that's good enough for warnings (reduces false positives > but surely doesn't eliminate them). OK. So it's more about building a proper must-alias query and less

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-08 Thread Richard Biener
On Mon, Aug 7, 2017 at 1:08 AM, Martin Sebor wrote: > On 08/03/2017 02:45 AM, Richard Biener wrote: >> >> On Wed, Aug 2, 2017 at 7:10 PM, Jeff Law wrote: >>> >>> On 08/01/2017 03:25 AM, Richard Biener wrote: On Tue, Aug 1, 2017 at 11:23 AM, Richard

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-06 Thread Martin Sebor
On 08/03/2017 02:45 AM, Richard Biener wrote: On Wed, Aug 2, 2017 at 7:10 PM, Jeff Law wrote: On 08/01/2017 03:25 AM, Richard Biener wrote: On Tue, Aug 1, 2017 at 11:23 AM, Richard Biener wrote: On Tue, Aug 1, 2017 at 4:27 AM, Martin Sebor

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-03 Thread Richard Biener
On Wed, Aug 2, 2017 at 7:10 PM, Jeff Law wrote: > On 08/01/2017 03:25 AM, Richard Biener wrote: >> On Tue, Aug 1, 2017 at 11:23 AM, Richard Biener >> wrote: >>> On Tue, Aug 1, 2017 at 4:27 AM, Martin Sebor wrote: Richard,

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-02 Thread Jeff Law
On 08/01/2017 03:25 AM, Richard Biener wrote: > On Tue, Aug 1, 2017 at 11:23 AM, Richard Biener > wrote: >> On Tue, Aug 1, 2017 at 4:27 AM, Martin Sebor wrote: >>> Richard, >>> >>> in discussing this work Jeff mentioned that your comments on >>> the

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-01 Thread Richard Biener
On Tue, Aug 1, 2017 at 11:23 AM, Richard Biener wrote: > On Tue, Aug 1, 2017 at 4:27 AM, Martin Sebor wrote: >> Richard, >> >> in discussing this work Jeff mentioned that your comments on >> the tree-ssa-alias.c parts would be helpful. When you have

Re: [PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-08-01 Thread Richard Biener
On Tue, Aug 1, 2017 at 4:27 AM, Martin Sebor wrote: > Richard, > > in discussing this work Jeff mentioned that your comments on > the tree-ssa-alias.c parts would be helpful. When you have > a chance could you please give it a once over and let me know > if you have any

[PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)

2017-07-31 Thread Martin Sebor
Richard, in discussing this work Jeff mentioned that your comments on the tree-ssa-alias.c parts would be helpful. When you have a chance could you please give it a once over and let me know if you have any suggestions or concerns? There are no visible changes to existing clients of the pass,