aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-01-25 16:38:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-01-25 16:38:26 +0000
commit194313e274b4054b72ca2b44841033f97160c745 (patch)
treec5579d7a1f5560c1a63423337a418a4054fce3bd /gcc/testsuite/gcc.dg/torture
parent147a0bcfc784a28e4ef09e32b23703e0ecc8bd55 (diff)
downloadgcc-194313e274b4054b72ca2b44841033f97160c745.zip
gcc-194313e274b4054b72ca2b44841033f97160c745.tar.gz
gcc-194313e274b4054b72ca2b44841033f97160c745.tar.bz2
re PR tree-optimization/47426 (wrong code with -O2 -fipa-pta)
2011-01-25 Richard Guenther <rguenther@suse.de> PR tree-optimization/47426 * tree-ssa-structalias.c (ipa_pta_execute): Make externally visible functions results escape. * gcc.dg/torture/pr47426-1.c: New testcase. * gcc.dg/torture/pr47426-2.c: Likewise. From-SVN: r169241
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47426-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47426-2.c19
2 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr47426-1.c b/gcc/testsuite/gcc.dg/torture/pr47426-1.c
new file mode 100644
index 0000000..47dcff9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr47426-1.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-fipa-pta" } */
+/* { dg-additional-sources "pr47426-2.c" } */
+
+void bar (int *i);
+
+static void
+foo (int *i)
+{
+ if (*i)
+ bar (i);
+ if (*i)
+ __builtin_abort();
+}
+
+typedef void tfoo (int *);
+
+tfoo *
+getfoo (void)
+{
+ return &foo;
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr47426-2.c b/gcc/testsuite/gcc.dg/torture/pr47426-2.c
new file mode 100644
index 0000000..a22e902
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr47426-2.c
@@ -0,0 +1,19 @@
+typedef void tfoo (int *);
+tfoo *getfoo (void);
+
+void
+bar (int *i)
+{
+ (*i)--;
+}
+
+int
+main ()
+{
+ int i = 1;
+ getfoo ()(&i);
+ if (i)
+ __builtin_abort ();
+ return 0;
+}
+