* ipa-icf.c (sem_variable::equals_wpa): Check FINAL flags.
authorJan Hubicka <hubicka@ucw.cz>
Thu, 5 Mar 2015 21:26:44 +0000 (22:26 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 5 Mar 2015 21:26:44 +0000 (21:26 +0000)
From-SVN: r221226

gcc/ChangeLog
gcc/ipa-icf.c

index c4496f5b758a55650ddd101a0fa7c45bfd49126b..9d2e92ba6bd526d21b9745e81a9ce14231e40db4 100644 (file)
@@ -1,3 +1,7 @@
+2015-03-05  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-icf.c (sem_variable::equals_wpa): Check FINAL flags.
+
 2015-03-05  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR target/64342
index a7f19d6fd8d69ed0312dc815bb7289a824ce27cd..7c4c852ed5f4815d4293ebc224260af9b2b2af5d 100644 (file)
@@ -1480,6 +1480,18 @@ sem_variable::equals_wpa (sem_item *item,
                                      ref->referred, ref2->referred,
                                      ref->address_matters_p ()))
        return false;
+
+      /* DECL_FINAL_P flag on methods referred by virtual tables is used
+        to decide on completeness possible_polymorphic_call_targets lists
+        and therefore it must match.  */
+      if ((DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
+         && (DECL_VIRTUAL_P (ref->referred->decl)
+             || DECL_VIRTUAL_P (ref2->referred->decl))
+         && ((DECL_VIRTUAL_P (ref->referred->decl)
+              != DECL_VIRTUAL_P (ref2->referred->decl))
+             || (DECL_FINAL_P (ref->referred->decl)
+                 != DECL_FINAL_P (ref2->referred->decl))))
+        return return_false_with_msg ("virtual or final flag mismatch");
     }
 
   return true;