This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]