From 75a23e59031fe673fc3b2e60fd1fe5f4c70ecb85 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 1 Aug 2020 17:57:08 +0200 Subject: [PATCH] Verify symtab order * symtab.c (symtab_node::verify_base): Verify order. (symtab_node::verify_symtab_nodes): Verify order. --- gcc/symtab.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gcc/symtab.c b/gcc/symtab.c index 0e852d4c24d..d7dfbb676df 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1085,6 +1085,11 @@ symtab_node::verify_base (void) error ("node has unknown type"); error_found = true; } + if (order < 0 || order >= symtab->order) + { + error ("node has invalid order %i", order); + error_found = true; + } if (symtab->state != LTO_STREAMING) { @@ -1326,6 +1331,14 @@ symtab_node::verify_symtab_nodes (void) { symtab_node *node; hash_map comdat_head_map (251); + asm_node *anode; + + for (anode = symtab->first_asm_symbol (); anode; anode = anode->next) + if (anode->order < 0 || anode->order >= symtab->order) + { + error ("invalid order in asm node %i", anode->order); + internal_error ("symtab_node::verify failed"); + } FOR_EACH_SYMBOL (node) { -- 2.30.2