From b275fd98f267ea870c9583e8a28f1348777786a3 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 15 Aug 2019 08:58:26 +0200 Subject: [PATCH] Add ::verify for cgraph_node::origin/nested/next_nested. 2019-08-15 Martin Liska * cgraph.c (cgraph_node::verify_node): Verify origin, nested and next_nested. From-SVN: r274503 --- gcc/ChangeLog | 5 +++++ gcc/cgraph.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27e09f26390..4b147c19d56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-08-15 Martin Liska + + * cgraph.c (cgraph_node::verify_node): Verify origin, nested + and next_nested. + 2019-08-15 Martin Liska PR ipa/91404 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); -- 2.30.2