Hi,
this patch fixes ICE seen with testcase for PR62121 that is pasto in size 
checking.
The GCC 4.9 issue is different and fixed in meantime.  I will backport that 
change.

Bootstrapped/regtested x86_64-linux, comitted.

        PR ipa/62121
        * ipa-polymorphic-call.c 
(ipa_polymorphic_call_context::restrict_to_inner_class):
        fix pasto in checking array size.

        * g++.dg/torture/pr62121.C: New testcase.
Index: ipa-polymorphic-call.c
===================================================================
--- ipa-polymorphic-call.c      (revision 215645)
+++ ipa-polymorphic-call.c      (working copy)
@@ -327,7 +327,7 @@ ipa_polymorphic_call_context::restrict_t
              && (cur_offset
                  + (expected_type ? tree_to_uhwi (TYPE_SIZE (expected_type))
                     : 0)
-                 > tree_to_uhwi (TYPE_SIZE (type))))
+                 > tree_to_uhwi (TYPE_SIZE (subtype))))
            goto no_useful_type_info;
 
          cur_offset = new_offset;
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