OSDN Git Service

2010-05-04 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr43879-1_1.C
diff --git a/gcc/testsuite/g++.dg/torture/pr43879-1_1.C b/gcc/testsuite/g++.dg/torture/pr43879-1_1.C
new file mode 100644 (file)
index 0000000..0c94338
--- /dev/null
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-fipa-pta" } */
+/* { dg-additional-sources "pr43879-1_0.C" } */
+
+struct A {
+    int *i;
+    A();
+    ~A();
+};
+
+static inline int
+aa(int *a, int *b)
+{
+  (void)b;
+  return *a;
+}
+
+struct B {
+    B() : i(0) {}
+    int i;
+    B(const A &a) : i(0)
+    {
+      f(*a.i);
+    }
+    void __attribute__((noinline, noclone))
+       f(int j)
+         {
+           aa(&i, &j);
+           i = 1;
+         }
+};
+
+int
+test()
+{
+  B b1;
+  B b2 = B(A());
+  b1 = B(A());
+  if (b1.i != b2.i) __builtin_abort();
+  return 0;
+}
+
+int
+main()
+{
+  return test();
+}
+