Hi,
this is 4.9 version of patch fixing ICE on ipa-devirt.c:997.
The problem is that we get TYPE_SIZE NUll but code does not expect it.

Honza

        PR ipa/62121
        * ipa-devirt.c (restrict_to_inner_class): Do not ICE when type is
        unknown.

        * g++.dg/torture/pr62121.C: New testcase.
Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c        (revision 215893)
+++ ipa-devirt.c        (working copy)
@@ -994,7 +994,8 @@ give_up:
   if ((TREE_CODE (type) != RECORD_TYPE
        || !TYPE_BINFO (type)
        || !polymorphic_type_binfo_p (TYPE_BINFO (type)))
-      && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
+      && (!TYPE_SIZE (type)
+         || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
          || (offset + tree_to_uhwi (TYPE_SIZE (expected_type)) <=
              tree_to_uhwi (TYPE_SIZE (type)))))
     return true;
Index: testsuite/g++.dg/torture/pr62121.C
===================================================================
--- testsuite/g++.dg/torture/pr62121.C  (revision 0)
+++ testsuite/g++.dg/torture/pr62121.C  (revision 0)
@@ -0,0 +1,12 @@
+// { dg-do compile }
+class A
+{
+  virtual double operator()();
+};
+class B : A
+{
+public:
+  double operator()();
+};
+extern B a[];
+int b = a[0]();

Reply via email to