re PR ipa/64059 (ICE: Segmentation fault in ipa-polymorphic-call.c:1593)
authorMarkus Trippelsdorf <trippels@gcc.gnu.org>
Tue, 25 Nov 2014 07:41:48 +0000 (07:41 +0000)
committerMarkus Trippelsdorf <trippels@gcc.gnu.org>
Tue, 25 Nov 2014 07:41:48 +0000 (07:41 +0000)
Fix PR64059

* ipa-prop.c (ipa_analyze_call_uses): Don't call get_dynamic_type when
devirtualization is disabled.

From-SVN: r218038

gcc/ChangeLog
gcc/ipa-prop.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr64059.C [new file with mode: 0644]

index 5db7497608b12f80a6059bb202cd54f0df3ff949..8ff9c72256d792349912e55904465b4d9fa88256 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-25  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/64059
+       * ipa-prop.c (ipa_analyze_call_uses): Don't call get_dynamic_type when
+       devirtualization is disabled.
+
 2014-11-24  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        PR target/63965
index 2e0016bfbe666544974ab7095e96ac75f8574982..eeffda449d9b7bfbff912b24c8490aec7e76f9d2 100644 (file)
@@ -2155,7 +2155,7 @@ ipa_analyze_call_uses (struct func_body_info *fbi, gcall *call)
   if (cs && !cs->indirect_unknown_callee)
     return;
 
-  if (cs->indirect_info->polymorphic)
+  if (cs->indirect_info->polymorphic && flag_devirtualize)
     {
       tree instance;
       tree target = gimple_call_fn (call);
index cee2f3d15b7eeda64110816069a3f95e7df6398d..147674e67ee9b0316cd2310bb92a18f5df458704 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-25  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR ipa/64059
+       * g++.dg/ipa/pr64059.C: New test.
+
 2014-11-24  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/63847
diff --git a/gcc/testsuite/g++.dg/ipa/pr64059.C b/gcc/testsuite/g++.dg/ipa/pr64059.C
new file mode 100644 (file)
index 0000000..0269b45
--- /dev/null
@@ -0,0 +1,56 @@
+// { dg-options "-r -nostdlib -O2 -flto -fno-devirtualize" }
+// { dg-require-effective-target lto }
+
+class A;
+class B
+{
+public:
+  A *operator->();
+};
+class C
+{
+public:
+  virtual void m_fn1 ();
+};
+class A
+{
+public:
+  C *m_fn2 ();
+};
+class D
+{
+public:
+  void
+  m_fn3 ()
+  {
+    list_m->m_fn2 ()->m_fn1 ();
+  }
+  B list_m;
+};
+
+class F
+{
+public:
+  D m_fn4 ();
+};
+class G
+{
+public:
+  F m_fn5 (int, int);
+};
+class H
+{
+public:
+  void
+  m_fn6 ()
+  {
+    fieldEngine_m.m_fn5 (0, 0).m_fn4 ().m_fn3 ();
+  }
+  G fieldEngine_m;
+};
+
+void
+fn1 (H a)
+{
+  a.m_fn6 ();
+}