diff mbox

[committed] fix ILP32 testsuite failures for after PR 80503

Message ID 61c68535-5184-4967-ddf0-3ccdfc1feca0@gmail.com
State New
Headers show

Commit Message

Martin Sebor May 1, 2017, 6:49 p.m. UTC
I committed r247444 as an obvious fix for the ILP32 failures
in gcc.dg/tree-ssa/builtin-sprintf-warn-18.c.  The committed
change is below for reference.

Martin

    /* 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

Comments

Andreas Schwab May 1, 2017, 7:04 p.m. UTC | #1
On Mai 01 2017, Martin Sebor <msebor@gmail.com> wrote:

> +  /* 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 } */

Please also make the test names unique.

Andreas.
diff mbox

Patch

diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index c3c717d..a3153c1 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/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c 
b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c
index 55c3974..961fa48 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 } */