[gcc r14-12681] ipa: Fix lifetime issue with hash_map::put in prepare_debug_expressions [PR125699]
Andrew Pinski
pinskia@gcc.gnu.org
Wed Jun 17 13:41:56 GMT 2026
https://gcc.gnu.org/g:ce8fbeb0b9d10b95e6941aeb3c9a86d24dcac2dd
commit r14-12681-gce8fbeb0b9d10b95e6941aeb3c9a86d24dcac2dd
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Tue Jun 9 18:12:52 2026 -0700
ipa: Fix lifetime issue with hash_map::put in prepare_debug_expressions [PR125699]
Here the code was originally:
tree *d = m_dead_ssa_debug_equiv.get (value);
m_dead_ssa_debug_equiv.put (dead_ssa, *d);
but hash_map::put's 2nd argument is a reference.
So if the hashmap decides it needs to resize, the argument
is freed. So the fix is simple change the type of d to tree
and dereference the get. Since tree is a pointer there is not
enough data to care about the extra copy.
r12-5630-gb3f60112edcb85 was a similar fix in the same function in fact.
Pushed as obvious after a bootstrapped and tested on x86_64-linux-gnu.
PR ipa/125699
gcc/ChangeLog:
* ipa-param-manipulation.cc (ipa_param_body_adjustments::prepare_debug_expressions): Fix
lifetime issue with m_dead_ssa_debug_equiv usage.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
(cherry picked from commit 225fb1e771972091445019f490b9a487b8b821fb)
Diff:
---
gcc/ipa-param-manipulation.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc
index ad36b8389c00..6179efcbe9d6 100644
--- a/gcc/ipa-param-manipulation.cc
+++ b/gcc/ipa-param-manipulation.cc
@@ -1348,8 +1348,8 @@ ipa_param_body_adjustments::prepare_debug_expressions (tree dead_ssa)
}
gcc_assert (TREE_CODE (value) == SSA_NAME);
- tree *d = m_dead_ssa_debug_equiv.get (value);
- m_dead_ssa_debug_equiv.put (dead_ssa, *d);
+ tree d = *m_dead_ssa_debug_equiv.get (value);
+ m_dead_ssa_debug_equiv.put (dead_ssa, d);
return true;
}
More information about the Gcc-cvs
mailing list