Hi,

  This patch fixes a whole bunch of failures reported for
  gcc.dg/tree-ssa/builtin-sprintf-warn-{3,10}.c for the avr target.

  builtin-sprintf-warn-10.c fails because the bounds in the warning
  messages expect 4 digit wide exponents i.e. __DBL_MAX_EXP__ > 999.
  For the avr, floats and doubles are both 32 bits wide, __DBL_MAX_EXP__
  == 128, and the max number of exponent digits can only be 3 .
  The computed size thus ends up one short of the value the test
  expects. The patch makes the test run only for targets with double64plus.

  builtin-sprintf-warn-3.c fails because the test appears to assume all
  non lp64 targets to be ilp32. For the avr, pointer size and int size
  are equal, but both are 16 bits, not 32. The patch fixes this by
  explicitly adding avr to the dejagnu selector.

  Ok for trunk?

Regards
Senthil

gcc/testsuite/ChangeLog:

2017-04-06  Senthil Kumar Selvaraj  <senthil_kumar.selva...@atmel.com>

        * gcc.dg/tree-ssa/builtin-sprintf-warn-10.c: Require double64plus.
        * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c (void test_too_large): Add
  avr-*-* to non-lp64 selector.


diff --git gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c 
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c
index 1213e89f7bb..30599ad04dc 100644
--- gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c
+++ gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c
@@ -2,6 +2,7 @@
    Test to verify the correctness of ranges of output computed for floating
    point directives.
    { dg-do compile }
+   { dg-require-effective-target double64plus }
    { dg-options "-O2 -Wformat -Wformat-overflow -ftrack-macro-expansion=0" } */
 
 typedef __builtin_va_list va_list;
diff --git gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c 
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
index 72ec3afaa41..9db7ad74f37 100644
--- gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
+++ gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
@@ -358,19 +358,19 @@ void test_too_large (char *d, int x, __builtin_va_list va)
 
   __builtin_snprintf (d, imax,    "%c", x);
   __builtin_snprintf (d, imax_p1, "%c", x);   /* { dg-warning "specified bound 
\[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */
-  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { ilp32 } } .-1 } */
+  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */
 
   __builtin_vsnprintf (d, imax,    "%c", va);
   __builtin_vsnprintf (d, imax_p1, "%c", va);   /* { dg-warning "specified 
bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */
-  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { ilp32 } } .-1 } */
+  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */
 
   __builtin___snprintf_chk (d, imax,    0, imax,    "%c", x);
   __builtin___snprintf_chk (d, imax_p1, 0, imax_p1, "%c", x);   /* { 
dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target 
lp64 } } */
-  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { ilp32 } } .-1 } */
+  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */
 
   __builtin___vsnprintf_chk (d, imax,    0, imax,    "%c", va);
   __builtin___vsnprintf_chk (d, imax_p1, 0, imax_p1, "%c", va);   /* { 
dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target 
lp64 } } */
-  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { ilp32 } } .-1 } */
+  /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" 
"INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */
 
   const size_t ptrmax = __PTRDIFF_MAX__;
   const size_t ptrmax_m1 = ptrmax - 1;

Reply via email to