aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2022-12-29 14:33:04 -0300
committerAlexandre Oliva <oliva@gnu.org>2022-12-29 14:39:47 -0300
commit8d48107702aa8027f5e8b35ade919c5c0d50ef1e (patch)
treee82a3d206136bfec36bfccb186e3d724589161d0 /gcc
parent1b9270852055f2641520fadd63328f997e76d367 (diff)
downloadgcc-8d48107702aa8027f5e8b35ade919c5c0d50ef1e.zip
gcc-8d48107702aa8027f5e8b35ade919c5c0d50ef1e.tar.gz
gcc-8d48107702aa8027f5e8b35ade919c5c0d50ef1e.tar.bz2
hash-map: reject empty-looking insertions
Check, after inserting entries, that they don't look empty. for gcc/ChangeLog * hash-map.h (put, get_or_insert): Check that entry does not look empty after insertion.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/hash-map.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h
index 457967f..63fa21c 100644
--- a/gcc/hash-map.h
+++ b/gcc/hash-map.h
@@ -169,11 +169,12 @@ public:
{
hash_entry *e = m_table.find_slot_with_hash (k, Traits::hash (k),
INSERT);
- bool ins = hash_entry::is_empty (*e);
+ bool ins = Traits::is_empty (*e);
if (ins)
{
e->m_key = k;
new ((void *) &e->m_value) Value (v);
+ gcc_checking_assert (!Traits::is_empty (*e));
}
else
e->m_value = v;
@@ -203,6 +204,7 @@ public:
{
e->m_key = k;
new ((void *)&e->m_value) Value ();
+ gcc_checking_assert (!Traits::is_empty (*e));
}
if (existed != NULL)