gcc/ChangeLog: 2019-08-14 Martin Liska <mli...@suse.cz>
* cgraph.c (cgraph_node::verify_node): Verify origin, nested and next_nested. --- gcc/cgraph.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index ed46d81a513..eb38b905879 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3464,6 +3464,30 @@ cgraph_node::verify_node (void) e->aux = 0; } } + + if (nested != NULL) + { + for (cgraph_node *n = nested; n != NULL; n = n->next_nested) + { + if (n->origin == NULL) + { + error ("missing origin for a node in a nested list"); + error_found = true; + } + else if (n->origin != this) + { + error ("origin points to a different parent"); + error_found = true; + break; + } + } + } + if (next_nested != NULL && origin == NULL) + { + error ("missing origin for a node in a nested list"); + error_found = true; + } + if (error_found) { dump (stderr);