aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr40579.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-06-29 11:57:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-06-29 11:57:15 +0000
commit09a782ebdacc6a5227ed464d47eb3cc27e252c6a (patch)
tree50e923e8964fbc46128696b82c92d91fa0a41a33 /gcc/testsuite/gcc.c-torture/execute/pr40579.c
parent152413f7edcf11d34026246569f5145d414f1653 (diff)
downloadgcc-09a782ebdacc6a5227ed464d47eb3cc27e252c6a.zip
gcc-09a782ebdacc6a5227ed464d47eb3cc27e252c6a.tar.gz
gcc-09a782ebdacc6a5227ed464d47eb3cc27e252c6a.tar.bz2
re PR tree-optimization/40579 (gcc -O2 optimization causes infinite loop and wrong output)
2009-06-29 Richard Guenther <rguenther@suse.de> PR tree-optimization/40579 * tree-vrp.c (vrp_evaluate_conditional): Bail out early if the IL to simplify has constants that overflowed. * gcc.c-torture/execute/pr40579.c: New testcase. From-SVN: r149046
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr40579.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr40579.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40579.c b/gcc/testsuite/gcc.c-torture/execute/pr40579.c
new file mode 100644
index 0000000..7f44af3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr40579.c
@@ -0,0 +1,28 @@
+extern void abort (void);
+static char * __attribute__((noinline))
+itos(int num)
+{
+ return (char *)0;
+}
+static void __attribute__((noinline))
+foo(int i, const char *x)
+{
+ if (i >= 4)
+ abort ();
+}
+int main()
+{
+ int x = -__INT_MAX__ + 3;
+ int i;
+
+ for (i = 0; i < 4; ++i)
+ {
+ char *p;
+ --x;
+ p = itos(x);
+ foo(i, p);
+ }
+
+ return 0;
+}
+