re PR ipa/62121 (ICE: Segmentation fault in ipa-devirt.c:997)
authorJan Hubicka <hubicka@ucw.cz>
Sat, 27 Sep 2014 00:19:06 +0000 (02:19 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 27 Sep 2014 00:19:06 +0000 (00:19 +0000)
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.

From-SVN: r215655

gcc/ChangeLog
gcc/ipa-polymorphic-call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr62121.C [new file with mode: 0644]

index e3a62f5f82b721368ab76eaa0c4f387056f6a0f1..203e1f53e07607cbedcb956d16b0656594ef6352 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-26  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/62121
+       * ipa-polymorphic-call.c (ipa_polymorphic_call_context::restrict_to_inner_class):
+       fix pasto in checking array size.
+
 2014-09-26  Jan Hubicka  <hubicka@ucw.cz>
 
        PR middle-end/35545
index 23f14ac60e38d54b86015f4288832d0a46702570..e682b2b45ddd36be9cc7ff706d6c8d70cb5a0188 100644 (file)
@@ -327,7 +327,7 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree expected_type)
              && (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 dd76fa5fbe33fe1d62272400596f606fe5e2e44b..e3396c54a81e0c3a3e390c99b85e85a0be8d5b5d 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-26  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/62121
+       * g++.dg/torture/pr62121.C: New testcase.
+
 2014-09-26  Jan Hubicka  <hubicka@ucw.cz>
 
        PR middle-end/35545
diff --git a/gcc/testsuite/g++.dg/torture/pr62121.C b/gcc/testsuite/g++.dg/torture/pr62121.C
new file mode 100644 (file)
index 0000000..de1196a
--- /dev/null
@@ -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]();