From ab038a807dcebed2e81592ca10031b3c5033b718 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 5 Mar 2015 22:26:44 +0100 Subject: [PATCH] * ipa-icf.c (sem_variable::equals_wpa): Check FINAL flags. From-SVN: r221226 --- gcc/ChangeLog | 4 ++++ gcc/ipa-icf.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4496f5b758..9d2e92ba6bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-03-05 Jan Hubicka + + * ipa-icf.c (sem_variable::equals_wpa): Check FINAL flags. + 2015-03-05 Vladimir Makarov PR target/64342 diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index a7f19d6fd8d..7c4c852ed5f 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -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; -- 2.30.2