Bug reported by Bruno Haible in
<https://lists.gnu.org/r/bug-gnulib/2022-04/msg00023.html>.
* lib/hamt.c (entry_insert): Remove technically undefined
behavior when shifting an integer of N bits by N or more bits.
+2022-08-12 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
+
+ hamt: fix technically undefined behavior
+ Bug reported by Bruno Haible in
+ <https://lists.gnu.org/r/bug-gnulib/2022-04/msg00023.html>.
+ * lib/hamt.c (entry_insert): Remove technically undefined
+ behavior when shifting an integer of N bits by N or more bits.
+
2022-08-09 Paul Eggert <eggert@cs.ucla.edu>
verify: port ‘assume’ to C23 non-GCC
Hamt_entry *new_entry = copy_entry (*elt_ptr);
if (replace)
*elt_ptr = NULL;
+ /* We have to take this shortcut as shifting an integer of N
+ bits by N or more bits triggers undefined behavior.
+ See: https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00023.html. */
+ if (depth >= _GL_HAMT_MAX_DEPTH)
+ return (Hamt_entry *) create_populated_bucket (new_entry, copy_entry (entry));
return create_populated_subtrie (new_entry, copy_entry (entry), hash,
(hash_element (functions, entry)
>> (5 * depth)), depth);