]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Don't reuse reference after potential resize.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 30 Nov 2021 00:53:50 +0000 (19:53 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Tue, 30 Nov 2021 01:01:08 +0000 (20:01 -0500)
When a new def chain is requested, any existing reference may no longer
be valid, so just use the object directly.

PR tree-optimization/103467
* gimple-range-gori.cc (range_def_chain::register_dependency): Don't
use an object reference after a potential resize.

gcc/gimple-range-gori.cc

index 911d7ac4ec8be83f2d810cd2781b28bbf5b9358d..0dba34b58c5d5db21197e531a7e84ba0a8f67556 100644 (file)
@@ -278,11 +278,12 @@ range_def_chain::register_dependency (tree name, tree dep, basic_block bb)
     {
       // Get the def chain for the operand.
       b = get_def_chain (dep);
-      // If there was one, copy it into result.
+      // If there was one, copy it into result.  Access def_chain directly
+      // as the get_def_chain request above could reallocate the vector.
       if (b)
-       bitmap_ior_into (src.bm, b);
+       bitmap_ior_into (m_def_chain[v].bm, b);
       // And copy the import list.
-      set_import (src, NULL_TREE, get_imports (dep));
+      set_import (m_def_chain[v], NULL_TREE, get_imports (dep));
     }
   else
     // Originated outside the block, so it is an import.