Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-28 Thread Rainer Orth
Rainer Orth writes: > Hi Martin, > >> On 11/26/18 10:52 AM, Rainer Orth wrote: >>> Hi Martin, >>> I have now committed this patch as r266418. >>> >>> this patch has created a bunch of XPASSes everywhere: >>> >>> +XPASS: gcc.dg/tree-ssa/builtin-fprintf-warn-1.c pr87756 (test for >>> warnings,

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-28 Thread Rainer Orth
Hi Martin, > On 11/26/18 10:52 AM, Rainer Orth wrote: >> Hi Martin, >> >>> I have now committed this patch as r266418. >> >> this patch has created a bunch of XPASSes everywhere: >> >> +XPASS: gcc.dg/tree-ssa/builtin-fprintf-warn-1.c pr87756 (test for >> warnings, line 119) >> +XPASS: gcc.dg/tree-

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-27 Thread Martin Sebor
On 11/26/18 10:52 AM, Rainer Orth wrote: Hi Martin, I have now committed this patch as r266418. this patch has created a bunch of XPASSes everywhere: +XPASS: gcc.dg/tree-ssa/builtin-fprintf-warn-1.c pr87756 (test for warnings, line 119) +XPASS: gcc.dg/tree-ssa/builtin-fprintf-warn-1.c pr877

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-26 Thread Jeff Law
On 11/26/18 1:55 PM, Martin Sebor wrote: > In the committed patch I forgot that the CONSTRUCTOR to STRING_CST > transformation introduced this summer only takes place for arrays > of char and not also those of wide characters.  That resulted in > sprintf incorrectly getting STRING_CSTs for individu

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-26 Thread Martin Sebor
In the committed patch I forgot that the CONSTRUCTOR to STRING_CST transformation introduced this summer only takes place for arrays of char and not also those of wide characters. That resulted in sprintf incorrectly getting STRING_CSTs for individual elements of constant wide character arrays li

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-26 Thread Martin Sebor
On 11/26/18 10:27 AM, Joseph Myers wrote: On Fri, 23 Nov 2018, Martin Sebor wrote: I have now committed this patch as r266418. This commit introduced spurious warnings that break the glibc testsuite build. bug-ungetwc2.c:62:17: error: '%ls' directive argument is not a nul-terminated string

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-26 Thread Rainer Orth
Hi Martin, > I have now committed this patch as r266418. this patch has created a bunch of XPASSes everywhere: +XPASS: gcc.dg/tree-ssa/builtin-fprintf-warn-1.c pr87756 (test for warnings, line 119) +XPASS: gcc.dg/tree-ssa/builtin-fprintf-warn-1.c pr87756 (test for warnings, line 120) +XPASS: g

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-26 Thread Joseph Myers
On Fri, 23 Nov 2018, Martin Sebor wrote: > I have now committed this patch as r266418. This commit introduced spurious warnings that break the glibc testsuite build. bug-ungetwc2.c:62:17: error: '%ls' directive argument is not a nul-terminated string [-Werror=format-overflow=] 62 | fprint

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-23 Thread Jakub Jelinek
On Fri, Nov 23, 2018 at 11:46:18AM -0700, Martin Sebor wrote: > I have now committed this patch as r266418. Two of the tests fail everywhere. Fixed thusly, committed as obvious: 2018-11-23 Jakub Jelinek PR tree-optimization/87756 * gcc.dg/builtin-memchr-2.c: Scan the gimple d

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-23 Thread Martin Sebor
I have now committed this patch as r266418. Martin On 11/6/18 5:05 PM, Martin Sebor wrote: Jeff, I'd like to go ahead and commit the patch as is.  I believe the use of the default argument is appropriate and in line with GCC practice.  Please let me know if you have strong objections. If I don'

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-11-06 Thread Martin Sebor
Jeff, I'd like to go ahead and commit the patch as is. I believe the use of the default argument is appropriate and in line with GCC practice. Please let me know if you have strong objections. If I don't hear any I will proceed later this week Thanks Martin On 10/30/2018 10:38 AM, Martin Sebor

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-10-30 Thread Martin Sebor
On 10/30/2018 09:54 AM, Jeff Law wrote: On 10/30/18 9:44 AM, Martin Sebor wrote: On 10/30/2018 09:27 AM, Jeff Law wrote: On 10/29/18 5:51 PM, Martin Sebor wrote: The missing nul detection fails when the argument of the %s or similar sprintf directive is the address of a non-nul character const

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-10-30 Thread Jeff Law
On 10/30/18 9:44 AM, Martin Sebor wrote: > On 10/30/2018 09:27 AM, Jeff Law wrote: >> On 10/29/18 5:51 PM, Martin Sebor wrote: >>> The missing nul detection fails when the argument of the %s or >>> similar sprintf directive is the address of a non-nul character >>> constant such as in: >>> >>>   co

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-10-30 Thread Martin Sebor
On 10/30/2018 09:27 AM, Jeff Law wrote: On 10/29/18 5:51 PM, Martin Sebor wrote: The missing nul detection fails when the argument of the %s or similar sprintf directive is the address of a non-nul character constant such as in: const char c = 'a'; int f (void) { return snprintf (0, 0

Re: [PATCH] detect missing nuls in address of const char (PR 87756)

2018-10-30 Thread Jeff Law
On 10/29/18 5:51 PM, Martin Sebor wrote: > The missing nul detection fails when the argument of the %s or > similar sprintf directive is the address of a non-nul character > constant such as in: > >   const char c = 'a'; >   int f (void) >   { > return snprintf (0, 0, "%s", &c); >   } > > Thi

[PATCH] detect missing nuls in address of const char (PR 87756)

2018-10-29 Thread Martin Sebor
The missing nul detection fails when the argument of the %s or similar sprintf directive is the address of a non-nul character constant such as in: const char c = 'a'; int f (void) { return snprintf (0, 0, "%s", &c); } This is because the string_constant function only succeeds for ar