On 05/03/2017 08:22 AM, Christophe Lyon wrote:
Hi,


On 29 April 2017 at 19:56, Andreas Schwab <sch...@linux-m68k.org> wrote:
On Apr 28 2017, Martin Sebor <mse...@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.  I committed a trivial fix for this on Monday
(https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00036.html).
I don't see the failures in recent test results for the few
ILP32 targets I've checked so I'm hoping they're gone but if
they persist on some others please let me know.

Martin

Reply via email to