[gcc(refs/users/aoliva/heads/testme)] Verify symtab order

Alexandre Oliva aoliva@gcc.gnu.org
Thu Aug 6 06:38:10 GMT 2020


https://gcc.gnu.org/g:75a23e59031fe673fc3b2e60fd1fe5f4c70ecb85

commit 75a23e59031fe673fc3b2e60fd1fe5f4c70ecb85
Author: Jan Hubicka <jh@suse.cz>
Date:   Sat Aug 1 17:57:08 2020 +0200

    Verify symtab order
    
            * symtab.c (symtab_node::verify_base): Verify order.
            (symtab_node::verify_symtab_nodes): Verify order.

Diff:
---
 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<tree, symtab_node *> 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)
     {


More information about the Gcc-cvs mailing list