This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Martin Sebor <msebor at gmail dot com>, Jeff Law <law at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 3 May 2017 16:22:05 +0200
- Subject: Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)
- Authentication-results: sourceware.org; auth=none
- References: <055b63b9-2303-6031-021c-c216e94ed072@gmail.com> <alpine.DEB.2.20.1704262224580.2840@digraph.polyomino.org.uk> <20170426223418.GV1809@tucnak> <7b8f6999-942c-1540-c6e6-a6284d57baf5@gmail.com> <d85393f5-bbf5-4898-579a-7b9c2ba8a624@redhat.com> <263b8441-72dd-0bb2-39ba-cfa3e820fddf@gmail.com> <877f236qt4.fsf@linux-m68k.org>
Hi,
On 29 April 2017 at 19:56, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Apr 28 2017, Martin Sebor <msebor@gmail.com> 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 "i", 0); /* { dg-warning "width out of range" } */
>> + /* { dg-warning "result to exceed .INT_MAX. " "" { target *-*-* } .-1 } */
>> + T ("%." MAX_P1_STR "i", 0); /* { dg-warning "precision out of range" } */
>
> FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 123)
> FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for warnings, line 125)
> FAIL: gcc.dg/tree-ssa/builtin-sprintf-warn-18.c (test for excess errors)
> Excess errors:
> /daten/aranym/gcc/gcc-20170429/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c:125:3: warning: '%.2147483648i' directive output of 2147483648 bytes causes result to exceed 'INT_MAX' [-Wformat-overflow=]
>
> Andreas.
I've noticed the same errors on arm* targets, if it's easier to reproduce.
Thanks,
Christophe
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."