re PR ipa/69239 (g++.dg/ipa/devirt-c-3.C FAILs with -O2 -fPIC --param=early-inlining...
authorJakub Jelinek <jakub@redhat.com>
Mon, 8 Feb 2016 17:41:35 +0000 (18:41 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 8 Feb 2016 17:41:35 +0000 (18:41 +0100)
PR ipa/69239
* g++.dg/ipa/pr69239.C: New test.

From-SVN: r233224

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr69239.C [new file with mode: 0644]

index 82521ec2935c5bf94a4a5e084168f866d7658315..c28912668c9b526ce73062115538ecb3a027eedb 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR ipa/69239
+       * g++.dg/ipa/pr69239.C: New test.
+
 2016-02-08  David Malcolm  <dmalcolm@redhat.com>
 
        PR preprocessor/69664
diff --git a/gcc/testsuite/g++.dg/ipa/pr69239.C b/gcc/testsuite/g++.dg/ipa/pr69239.C
new file mode 100644 (file)
index 0000000..913e4b1
--- /dev/null
@@ -0,0 +1,71 @@
+// PR ipa/69239
+// { dg-do run }
+// { dg-options "-O2 --param=early-inlining-insns=196" }
+// { dg-additional-options "-fPIC" { target fpic } }
+
+struct D
+{
+  float f;
+  D () {}
+  virtual float bar (float z);
+};
+
+struct A
+{
+  A ();
+  virtual int foo (int i);
+};
+
+struct B : public D, public A
+{
+  virtual int foo (int i);
+};
+
+float
+D::bar (float)
+{
+  return f / 2;
+}
+
+int
+A::foo (int i)
+{
+  return i + 1;
+}
+
+int
+B::foo (int i)
+{
+  return i + 2;
+}
+
+int __attribute__ ((noinline,noclone))
+baz ()
+{
+  return 1;
+}
+
+static int __attribute__ ((noinline))
+fn (A *obj, int i)
+{
+  return obj->foo (i);
+}
+
+inline __attribute__ ((always_inline))
+A::A ()
+{
+  if (fn (this, baz ()) != 2)
+    __builtin_abort ();
+}
+
+static void
+bah ()
+{
+  B b;
+}
+
+int
+main ()
+{
+  bah ();
+}