From 1124cf27b9730eb09f9160cae3da2846e2637775 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 30 Nov 2016 19:16:03 +0000 Subject: [PATCH] PR tree-optimization/78586 - [7 Regression] Wrong code caused by printf-return-value gcc/testsuite/ChangeLog: PR tree-optimization/78586 * gcc.dg/tree-ssa/builtin-sprintf-2.c: New test cases. From-SVN: r243081 --- gcc/testsuite/ChangeLog | 5 ++++ .../gcc.dg/tree-ssa/builtin-sprintf-2.c | 29 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe0edd71f66..0924207df58 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Martin Sebor + + PR tree-optimization/78586 + * gcc.dg/tree-ssa/builtin-sprintf-2.c: New test cases. + 2016-11-30 Vladimir Makarov PR tree-optimization/77856 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c index 6279956c411..4dddccdf44d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c @@ -13,7 +13,11 @@ # define LINE 0 #endif -#define INT_MAX __INT_MAX__ +#define INT_MAX __INT_MAX__ +#define INT_MIN (-INT_MAX - 1) + +#define LONG_MAX __LONG_MAX__ +#define LONG_MIN (-LONG_MAX - 1) char *buf; char buf8k [8192]; @@ -50,8 +54,13 @@ char buf8k [8192]; } \ } +typedef __SIZE_TYPE__ size_t; + extern int i; +extern unsigned u; extern long li; +extern unsigned long lu; +extern size_t sz; extern char *str; extern double d; @@ -162,6 +171,20 @@ RNG (0, 4, 7, "%i", i) RNG (0, 5, 7, "%i", i) RNG (0, 6, 7, "%i", i) +RNG (4, 4, 32, "%i", i) +RNG (4, 4, 32, "%u", u) +RNG (4, 4, 32, "%li", li) +RNG (4, 4, 32, "%lu", lu) +RNG (4, 4, 32, "%zu", sz) + +/* Exercise bug 78586. */ +RNG (4, 4, 32, "%lu", (unsigned long)i) +RNG (4, 4, 32, "%lu", (unsigned)u) +RNG (4, 4, 32, "%lu", (unsigned long)li) +RNG (4, 4, 32, "%lu", (unsigned long)lu) +RNG (4, 4, 32, "%lu", (unsigned long)sz) + + #if __SIZEOF_INT__ == 4 /* A 32-bit int takes up at most 11 bytes (-2147483648) not including @@ -252,5 +275,5 @@ RNG (0, 6, 8, "%s%ls", "1", L"2"); */ -/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 114 "optimized" { target { ilp32 || lp64 } } } } */ -/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 83 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } } */ +/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 124 "optimized" { target { ilp32 || lp64 } } } } */ +/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 93 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } } */ -- 2.30.2