Subject: Backport r247097

2017-04-24  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	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>

	Backport from mainline
	2017-04-24  Martin Liska  <mliska@suse.cz>

	PR middle-end/79931
	* g++.dg/ipa/pr79931.C: New test.

From-SVN: r247102
This commit is contained in:
Martin Liska 2017-04-24 16:48:43 +02:00 committed by Martin Liska
parent 5871268a1b
commit 84341de847
4 changed files with 47 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2017-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-24 Jan Hubicka <hubicka@ucw.cz>
PR middle-end/79931
* ipa-devirt.c (dump_possible_polymorphic_call_targets): Fix ICE.
2017-04-20 Alexander Monakov <amonakov@ispras.ru>
Backport from mainline

View File

@ -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");
}

View File

@ -1,3 +1,11 @@
2017-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-24 Martin Liska <mliska@suse.cz>
PR middle-end/79931
* g++.dg/ipa/pr79931.C: New test.
2017-04-21 Eric Botcazou <ebotcazou@adacore.com>
PR tree-optimization/80426

View File

@ -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();
}