summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-04-25 14:30:54 -0400
committerGitHub <noreply@github.com>2022-04-25 14:30:54 -0400
commit5c61caa48154e3e43ff29ab865310aa9bdd9e83a (patch)
treed727a4bf729dc7b55332db62c6cbcd3924807785 /vm_method.c
parent9c44b5fbc88cde1915a78265e72692e100cec16e (diff)
downloadruby-5c61caa48154e3e43ff29ab865310aa9bdd9e83a.tar.gz
Fix strict aliasing issue with call to rb_id_table_lookup()
Previously, GCC 11 with -O2 LTO issues -Wmaybe-uninitialized here.
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c
index c4b95f9391..6194267077 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -139,10 +139,11 @@ void rb_clear_constant_cache(void) {}
void
rb_clear_constant_cache_for_id(ID id)
{
+ VALUE lookup_result;
rb_vm_t *vm = GET_VM();
- st_table *ics;
- if (rb_id_table_lookup(vm->constant_cache, id, (VALUE *) &ics)) {
+ if (rb_id_table_lookup(vm->constant_cache, id, &lookup_result)) {
+ st_table *ics = (st_table *)lookup_result;
st_foreach(ics, rb_clear_constant_cache_for_id_i, (st_data_t) NULL);
ruby_vm_constant_cache_invalidations += ics->num_entries;
}