diff options
author | Martin Liska <marxin@gcc.gnu.org> | 2017-04-24 13:16:34 +0000 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-04-24 13:16:34 +0000 |
commit | 3ebd8e620b5a816436aec60572aaa4d31390d977 (patch) | |
tree | cf080e126604d97223a82bf7269165ddebb100ad /gcc | |
parent | f30a1190ffff2c7fd5df923dbae1c16549cb8575 (diff) | |
download | gcc-3ebd8e620b5a816436aec60572aaa4d31390d977.zip gcc-3ebd8e620b5a816436aec60572aaa4d31390d977.tar.gz gcc-3ebd8e620b5a816436aec60572aaa4d31390d977.tar.bz2 |
Fix (PR middle-end/79931)
2017-04-24 Jan Hubicka <hubicka@ucw.cz>
PR middle-end/79931
* ipa-devirt.c (dump_possible_polymorphic_call_targets): Fix ICE.
2017-04-24 Martin Liska <mliska@suse.cz>
PR middle-end/79931
* g++.dg/ipa/pr79931.C: New test.
From-SVN: r247097
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-devirt.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/pr79931.C | 24 |
4 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a6f000..487e8b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-04-24 Jan Hubicka <hubicka@ucw.cz> + + PR middle-end/79931 + * ipa-devirt.c (dump_possible_polymorphic_call_targets): Fix ICE. + 2017-04-24 Richard Biener <rguenther@suse.de> PR tree-optimization/80494 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 0c74c87..e013a26 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -3367,7 +3367,13 @@ dump_possible_polymorphic_call_targets (FILE *f, fprintf (f, " Speculative targets:"); dump_targets (f, targets); } - gcc_assert (targets.length () <= len); + /* Ugly: during callgraph construction the target cache may get populated + before all targets are found. While this is harmless (because all local + types are discovered and only in those case we devirtualize fully and we + don't do speculative devirtualization before IPA stage) it triggers + assert here when dumping at that stage also populates the case with + speculative targets. Quietly ignore this. */ + gcc_assert (symtab->state < IPA_SSA || targets.length () <= len); fprintf (f, "\n"); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 740de77..8032d96 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-24 Martin Liska <mliska@suse.cz> + + PR middle-end/79931 + * g++.dg/ipa/pr79931.C: New test. + 2017-04-24 Richard Biener <rguenther@suse.de> PR tree-optimization/80494 diff --git a/gcc/testsuite/g++.dg/ipa/pr79931.C b/gcc/testsuite/g++.dg/ipa/pr79931.C new file mode 100644 index 0000000..78f6e03 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr79931.C @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-all" } */ + +class DocumentImpl; +struct NodeImpl +{ + virtual DocumentImpl * getOwnerDocument(); + virtual NodeImpl * getParentNode(); + virtual NodeImpl * removeChild(NodeImpl *oldChild); +}; +struct AttrImpl : NodeImpl +{ + NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); +}; +struct DocumentImpl : NodeImpl +{ + virtual NodeImpl *removeChild(NodeImpl *oldChild); + virtual int* getRanges(); +}; +NodeImpl *AttrImpl::insertBefore(NodeImpl *newChild, NodeImpl *refChild) { + NodeImpl *oldparent = newChild->getParentNode(); + oldparent->removeChild(newChild); + this->getOwnerDocument()->getRanges(); +} |