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 shows

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. ] >> >>> >>> >>> gcc-78918.diff >

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: > > P

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 f

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 allowin

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 f

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 VRP

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 memcpy). I also built G

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 one instance of the w

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 o

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, a

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

2017-11-09 Thread Martin Sebor
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01642.html 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 VRP machinery. Richard, in considering you suggestions I realized that the ao_ref s

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 of

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 only

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 wrote: >> >> Well, simp

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 isn't a must-alias qu

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 that's good enough for

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 query > but maybe

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 (reduces false posi

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 i

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 Biener wrote: > > On Tue

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 wrote: Richard, in discussing this work Jeff ment

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, in discussing this work Jeff mentioned that your comments o

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 tree-ssa-alias.c parts would be helpful. When

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 >> a chance could you please give it a once ov

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 suggestions or concerns?

[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, j

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

2017-07-24 Thread Martin Sebor
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01264.html This change is related to [PATCH] enhance -Wrestrict for sprintf %s arguments https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01176.html On 07/20/2017 02:45 PM, Martin Sebor wrote: With more testing (building GDB, Glibc, Busyb

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

2017-07-16 Thread Martin Sebor
Being implemented in the front end, the -Wrestrict warning detects only trivial instances of violations. The attached patch extends the implementation to the middle-end where data flow and alias analysis can be combined to detect even complex cases of overlap. This work is independent of but fol