mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix strict aliasing issue with call to rb_id_table_lookup()
Previously, GCC 11 with -O2 LTO issues -Wmaybe-uninitialized here.
This commit is contained in:
parent
9c44b5fbc8
commit
5c61caa481
Notes:
git
2022-04-26 03:31:14 +09:00
Merged: https://github.com/ruby/ruby/pull/5844 Merged-By: XrXr
1 changed files with 3 additions and 2 deletions
|
@ -139,10 +139,11 @@ void rb_clear_constant_cache(void) {}
|
||||||
void
|
void
|
||||||
rb_clear_constant_cache_for_id(ID id)
|
rb_clear_constant_cache_for_id(ID id)
|
||||||
{
|
{
|
||||||
|
VALUE lookup_result;
|
||||||
rb_vm_t *vm = GET_VM();
|
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);
|
st_foreach(ics, rb_clear_constant_cache_for_id_i, (st_data_t) NULL);
|
||||||
ruby_vm_constant_cache_invalidations += ics->num_entries;
|
ruby_vm_constant_cache_invalidations += ics->num_entries;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue