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