re PR tree-optimization/35833 (Wrong code generated with -ftree-vrp)
authorRichard Guenther <rguenther@suse.de>
Sat, 5 Apr 2008 18:04:07 +0000 (18:04 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 5 Apr 2008 18:04:07 +0000 (18:04 +0000)
2008-04-05  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/35833
* gcc.dg/torture/pr35833.c: New testcase.

From-SVN: r133941

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr35833.c [new file with mode: 0644]

index 08e354548bb75b15a551f52f39b21e04f79e9118..720118a170e63f42e2029d36ca7b38db3f729aa3 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-05  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/35833
+       * gcc.dg/torture/pr35833.c: New testcase.
+
 2008-04-04  Naveen.H.S  <naveen.hs@kpitcummins.com>
 
        * gcc.target/sh/sh2a-band.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr35833.c b/gcc/testsuite/gcc.dg/torture/pr35833.c
new file mode 100644 (file)
index 0000000..2e740f2
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-ftree-vrp" } */
+
+struct S {struct S *field;};
+struct S True, False, Z;
+static inline int f(void) {return 1;}
+static inline int g(struct S **obj) {
+   return f() && *obj == &Z;
+}
+struct S **h(struct S **x) {
+   if (x)
+      return g(x) ? &True.field : &False.field;
+   else
+      return &True.field;
+}
+extern void abort (void);
+int main()
+{
+  if (h(&False.field) != &False.field)
+    abort ();
+  return 0;
+}