From: Martin Sebor Date: Mon, 1 May 2017 18:45:46 +0000 (+0000) Subject: gimple-ssa-sprintf.c (format_integer): Set knownrange when it's known. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d82d0bc4350ce18a5fb64049d24e98dee1235f9;p=gcc.git gimple-ssa-sprintf.c (format_integer): Set knownrange when it's known. gcc/ChangeLog: * gimple-ssa-sprintf.c (format_integer): Set knownrange when it's known. gcc/testsuite/ChangeLog: * tree-ssa/builtin-sprintf-warn-18.c: Adjust to avoid failures on ILP32 targets. From-SVN: r247444 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c58e4173880..0157559daef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-05-01 Martin Sebor + + * gimple-ssa-sprintf.c (format_integer): Set knownrange when it's + known. + 2017-05-01 Uros Bizjak PR target/68491 diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index c3c717d9060..a3153c10019 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -1390,6 +1390,7 @@ format_integer (const directive &dir, tree arg) res.range.max = tree_digits (arg, base, dir.prec[1], maybesign, maybebase); res.range.likely = res.range.min; + res.knownrange = true; } res.range.unlikely = res.range.max; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c2283a22b5..9d69bf7561c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-01 Martin Sebor + + * tree-ssa/builtin-sprintf-warn-18.c: Adjust to avoid failures + on ILP32 targets. + 2017-05-01 Tom de Vries * gcc.dg/pr78768.c: Require linker plugin. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c index 55c397457ff..961fa487bb9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c @@ -114,18 +114,15 @@ void test_characters () 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" } */ + /* The range here happens to be a property of the compiler, not + one of the target. */ + T ("%9223372036854775808i", 0); /* { dg-warning "width out of range" } */ + /* { dg-warning "result to exceed .INT_MAX." "" { target *-*-* } .-1 } */ + T ("%.9223372036854775808i", 0); /* { dg-warning "precision out of range" } */ + /* { dg-warning "causes result to exceed .INT_MAX." "" { target *-*-* } .-1 } */ /* The following is diagnosed by -Wformat (disabled here). */ - /* T ("%" MAX_P1_STR "$i", 0); */ + /* T ("%9223372036854775808$i", 0); */ } /* Verify that an excessively long directive is truncated and the truncation