Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2018-02-01 Thread Martin Sebor
On 02/01/2018 04:54 AM, Renlin Li wrote: Hi Martin, On 01/02/18 00:40, Martin Sebor wrote: On 01/31/2018 10:36 AM, Renlin Li wrote: Hi there, I have a patch to fix to regressions we observed in armhf native environment. To effectively check out of range for format string, a target type shou

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2018-02-01 Thread Renlin Li
Hi Martin, On 01/02/18 00:40, Martin Sebor wrote: On 01/31/2018 10:36 AM, Renlin Li wrote: Hi there, I have a patch to fix to regressions we observed in armhf native environment. To effectively check out of range for format string, a target type should be used. And according to the standard,

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2018-01-31 Thread Martin Sebor
On 01/31/2018 10:36 AM, Renlin Li wrote: Hi there, I have a patch to fix to regressions we observed in armhf native environment. To effectively check out of range for format string, a target type should be used. And according to the standard, int type is used for "width" and "precision" field o

Re: Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2018-01-31 Thread Renlin Li
Hi there, I have a patch to fix to regressions we observed in armhf native environment. To effectively check out of range for format string, a target type should be used. And according to the standard, int type is used for "width" and "precision" field of format string. Here target_strtol10 is

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-06-20 Thread Renlin Li
Hi Martin, I did a little investigation into this. Please correct me if I missed anything. I build a native arm-linux-gnueabihf toolchain in armhf hardware. It's ILP32. So in this situation: HOST_WIDE_INT is long, which is 32-bit. integer type 32-bit as well, so target_int_max () == LONG_MAX

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-06-13 Thread Renlin Li
Hi Martin, On 04/06/17 23:24, Martin Sebor wrote: On 06/02/2017 09:38 AM, Renlin Li wrote: Hi Martin, After r247444, I saw the following two regressions in arm-linux-gnueabihf environment: FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 119) PASS: gcc.dg/tree-ssa/bui

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-06-04 Thread Martin Sebor
On 06/02/2017 09:38 AM, Renlin Li wrote: Hi Martin, After r247444, I saw the following two regressions in arm-linux-gnueabihf environment: FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 119) PASS: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 121

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-06-02 Thread Renlin Li
Hi Martin, After r247444, I saw the following two regressions in arm-linux-gnueabihf environment: FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 119) PASS: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 121) FAIL: gcc.dg/tree-ssa/builtin-sprintf-w

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-05-03 Thread Christophe Lyon
On 3 May 2017 at 16:54, Martin Sebor wrote: > On 05/03/2017 08:22 AM, Christophe Lyon wrote: >> >> Hi, >> >> >> On 29 April 2017 at 19:56, Andreas Schwab wrote: >>> >>> On Apr 28 2017, Martin Sebor wrote: >>> +void test_width_and_precision_out_of_range (char *d) +{ +#if __LONG_MAX

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-05-03 Thread Martin Sebor
On 05/03/2017 08:22 AM, Christophe Lyon wrote: Hi, On 29 April 2017 at 19:56, Andreas Schwab wrote: On Apr 28 2017, Martin Sebor wrote: +void test_width_and_precision_out_of_range (char *d) +{ +#if __LONG_MAX__ == 2147483647 +# define MAX_P1_STR "2147483648" +#elif __LONG_MAX__ == 92233

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-05-03 Thread Christophe Lyon
Hi, On 29 April 2017 at 19:56, Andreas Schwab wrote: > On Apr 28 2017, Martin Sebor wrote: > >> +void test_width_and_precision_out_of_range (char *d) >> +{ >> +#if __LONG_MAX__ == 2147483647 >> +# define MAX_P1_STR "2147483648" >> +#elif __LONG_MAX__ == 9223372036854775807 >> +# define MAX_

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-29 Thread Andreas Schwab
On Apr 28 2017, Martin Sebor wrote: > +void test_width_and_precision_out_of_range (char *d) > +{ > +#if __LONG_MAX__ == 2147483647 > +# define MAX_P1_STR "2147483648" > +#elif __LONG_MAX__ == 9223372036854775807 > +# define MAX_P1_STR "9223372036854775808" > +#endif > + > + T ("%" MAX_P1_STR

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-28 Thread Jeff Law
On 04/28/2017 12:05 PM, Martin Sebor wrote: So the initialization could be done once per translation unit rather than once per function -- assuming the target character set doesn't change within a translation unit. That seems like it ought to be easy. It is easy. I was going to respond by sa

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-28 Thread Martin Sebor
On 04/28/2017 10:22 AM, Jeff Law wrote: On 04/27/2017 03:05 PM, Martin Sebor wrote: On 04/26/2017 04:34 PM, Jakub Jelinek wrote: Also, can't there be a way to shortcut all this processing if the charsets are the same? And is it a good idea if every pass that needs to do something with the exe

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-28 Thread Jeff Law
On 04/28/2017 10:27 AM, Jakub Jelinek wrote: On Fri, Apr 28, 2017 at 10:22:29AM -0600, Jeff Law wrote: So the initialization could be done once per translation unit rather than once per function -- assuming the target character set doesn't change within a translation unit. That seems like it ou

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-28 Thread Jakub Jelinek
On Fri, Apr 28, 2017 at 10:22:29AM -0600, Jeff Law wrote: > So the initialization could be done once per translation unit rather than > once per function -- assuming the target character set doesn't change within > a translation unit. > > That seems like it ought to be easy. > > The table-lookup

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-28 Thread Jeff Law
On 04/27/2017 03:05 PM, Martin Sebor wrote: On 04/26/2017 04:34 PM, Jakub Jelinek wrote: Also, can't there be a way to shortcut all this processing if the charsets are the same? And is it a good idea if every pass that needs to do something with the exec charset chars caches its own results

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-27 Thread Martin Sebor
On 04/26/2017 04:34 PM, Jakub Jelinek wrote: On Wed, Apr 26, 2017 at 10:26:56PM +, Joseph Myers wrote: On Wed, 26 Apr 2017, Martin Sebor wrote: Testing my solution for bug 77671 (missing -Wformat-overflow sprintf with "%s") caused a regression in the charset/builtin2.c test for bug 25120 (

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-26 Thread Jakub Jelinek
On Wed, Apr 26, 2017 at 10:26:56PM +, Joseph Myers wrote: > On Wed, 26 Apr 2017, Martin Sebor wrote: > > > Testing my solution for bug 77671 (missing -Wformat-overflow > > sprintf with "%s") caused a regression in the charset/builtin2.c > > test for bug 25120 (builtin *printf handlers are conf

Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-26 Thread Joseph Myers
On Wed, 26 Apr 2017, Martin Sebor wrote: > Testing my solution for bug 77671 (missing -Wformat-overflow > sprintf with "%s") caused a regression in the charset/builtin2.c > test for bug 25120 (builtin *printf handlers are confused by > -fexec-charset). That led me to realize that like -Wformat >

[PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)

2017-04-26 Thread Martin Sebor
Testing my solution for bug 77671 (missing -Wformat-overflow sprintf with "%s") caused a regression in the charset/builtin2.c test for bug 25120 (builtin *printf handlers are confused by -fexec-charset). That led me to realize that like -Wformat itself, the whole gimple-ssa-sprintf pass is oblivi