From: "Martin Liška" <mliska@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Jan Hubicka <hubicka@ucw.cz>
Subject: [PATCH] Fix PR ipa/65722
Date: Fri, 10 Apr 2015 16:15:00 -0000 [thread overview]
Message-ID: <5527F705.5020509@suse.cz> (raw)
[-- Attachment #1: Type: text/plain, Size: 222 bytes --]
Hello.
Attached patch fixes PR, where we should consider just cgraph_nodes as
objects referred by virtual table.
Patch survives regression tests on x86_64-linux-pc with enabled checking.
Ready for trunk?
Thanks,
Martin
[-- Attachment #2: 0001-Fix-PR-ipa-65722.patch --]
[-- Type: text/x-patch, Size: 1783 bytes --]
From 8bff38438f6ba57732a6c3ccc3632f6789ca4d7e Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Fri, 10 Apr 2015 11:37:04 +0200
Subject: [PATCH] Fix PR ipa/65722.
gcc/testsuite/ChangeLog:
2015-04-10 Martin Liska <mliska@suse.cz>
* g++.dg/ipa/pr65722.C: New test.
gcc/ChangeLog:
2015-04-10 Martin Liska <mliska@suse.cz>
PR ipa/65722
* ipa-icf.c (sem_variable::equals_wpa): Consider comparsion just
for references coming from cgraph nodes.
---
gcc/ipa-icf.c | 4 ++++
gcc/testsuite/g++.dg/ipa/pr65722.C | 21 +++++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/ipa/pr65722.C
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 8f8a0cf..9e5d19c 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -1670,6 +1670,10 @@ sem_variable::equals_wpa (sem_item *item,
/* 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 (!is_a <cgraph_node *> (ref->referred)
+ || !is_a <cgraph_node *> (ref2->referred))
+ continue;
+
if ((DECL_VIRTUAL_P (decl) || DECL_VIRTUAL_P (item->decl))
&& (DECL_VIRTUAL_P (ref->referred->decl)
|| DECL_VIRTUAL_P (ref2->referred->decl))
diff --git a/gcc/testsuite/g++.dg/ipa/pr65722.C b/gcc/testsuite/g++.dg/ipa/pr65722.C
new file mode 100644
index 0000000..ee4ea24
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr65722.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-O -fipa-icf -fno-rtti" }
+
+struct A
+{
+ virtual void f ()
+ {
+ __builtin_abort ();
+ }
+ virtual void g ();
+};
+
+struct B : virtual A { };
+struct C : B, virtual A { };
+
+void foo()
+{
+ C c;
+ C *p = &c;
+ p->f ();
+}
--
2.1.4
next reply other threads:[~2015-04-10 16:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 16:15 Martin Liška [this message]
2015-04-10 16:28 ` Jakub Jelinek
2015-04-10 16:38 ` Jan Hubicka
2015-04-11 17:11 ` Jan Hubicka
2015-04-12 1:11 ` Jan Hubicka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5527F705.5020509@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).