Skip to content

Commit 5c61caa

Browse files
authored
Fix strict aliasing issue with call to rb_id_table_lookup()
Previously, GCC 11 with -O2 LTO issues -Wmaybe-uninitialized here.
1 parent 9c44b5f commit 5c61caa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vm_method.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ void rb_clear_constant_cache(void) {}
139139
void
140140
rb_clear_constant_cache_for_id(ID id)
141141
{
142+
VALUE lookup_result;
142143
rb_vm_t *vm = GET_VM();
143-
st_table *ics;
144144

145-
if (rb_id_table_lookup(vm->constant_cache, id, (VALUE *) &ics)) {
145+
if (rb_id_table_lookup(vm->constant_cache, id, &lookup_result)) {
146+
st_table *ics = (st_table *)lookup_result;
146147
st_foreach(ics, rb_clear_constant_cache_for_id_i, (st_data_t) NULL);
147148
ruby_vm_constant_cache_invalidations += ics->num_entries;
148149
}

0 commit comments

Comments
 (0)