From: Senthil Kumar Selvaraj Date: Tue, 11 Apr 2017 05:09:41 +0000 (+0000) Subject: Fix bogus builtin-sprintf-warn-{3,10}.c failures for avr. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=abde687ac31890d073a6e769b19ef3ad5d9433a2;p=gcc.git Fix bogus builtin-sprintf-warn-{3,10}.c failures for avr. 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. gcc/testsuite 2017-04-06 Senthil Kumar Selvaraj * 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. From-SVN: r246831 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8da9f094801..a2d08655028 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-04-11 Senthil Kumar Selvaraj + + * 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. + 2017-04-10 Martin Sebor * gcc.dg/pr40340-3.c: Adjust directive pattern. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c index 1213e89f7bb..30599ad04dc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c +++ b/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 a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c index 72ec3afaa41..9db7ad74f37 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c +++ b/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;