public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5587] Don't reuse reference after potential resize.
@ 2021-11-30  1:05 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-11-30  1:05 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ab202b659dbdfd3a1f45ffe7a5052f35b5e8fa6d

commit r12-5587-gab202b659dbdfd3a1f45ffe7a5052f35b5e8fa6d
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Nov 29 19:53:50 2021 -0500

    Don't reuse reference after potential resize.
    
    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.

Diff:
---
 gcc/gimple-range-gori.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 911d7ac4ec8..0dba34b58c5 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-30  1:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  1:05 [gcc r12-5587] Don't reuse reference after potential resize Andrew Macleod

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).