From: Martin Liska Date: Fri, 23 Aug 2019 11:41:32 +0000 (+0200) Subject: Backport r274503 X-Git-Tag: releases/gcc-9.3.0~693 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=009fed7825868ac3796771050d6953c2b45767e1;p=thirdparty%2Fgcc.git Backport r274503 2019-08-23 Martin Liska Backport from mainline 2019-08-15 Martin Liska * cgraph.c (cgraph_node::verify_node): Verify origin, nested and next_nested. From-SVN: r274852 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc42afe4079f..9d3214e02927 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-23 Martin Liska + + Backport from mainline + 2019-08-15 Martin Liska + + * cgraph.c (cgraph_node::verify_node): Verify origin, nested + and next_nested. + 2019-08-23 Martin Liska Backport from mainline diff --git a/gcc/cgraph.c b/gcc/cgraph.c index db4c9c747b9e..d9e7353bd7bf 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3449,6 +3449,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);