From: "alanwu (Alan Wu) via ruby-core" Date: 2023-01-04T23:15:10+00:00 Subject: [ruby-core:111633] [Ruby master Bug#19248] TestGCCompact#test_moving_objects_between_size_pools test failure Issue #19248 has been updated by alanwu (Alan Wu). Looking at `rb_shape_traverse_from_new_root()`, it seems like it's triggering UB in a way that also failed with LTO in the past. Maybe try this patch to confirm? ```patch diff --git a/shape.c b/shape.c index 7580003412..8e75f4a270 100644 --- a/shape.c +++ b/shape.c @@ -449,6 +449,7 @@ rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *dest_shap { RUBY_ASSERT(initial_shape->type == SHAPE_T_OBJECT); rb_shape_t *next_shape = initial_shape; + VALUE lookup_result; if (dest_shape->type != initial_shape->type) { next_shape = rb_shape_traverse_from_new_root(initial_shape, rb_shape_get_parent(dest_shape)); @@ -462,7 +463,10 @@ rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *dest_shap if (!next_shape->edges) { return NULL; } - if (!rb_id_table_lookup(next_shape->edges, dest_shape->edge_name, (VALUE *)&next_shape)) { + if (rb_id_table_lookup(next_shape->edges, dest_shape->edge_name, &lookup_result)) { + next_shape = (rb_shape_t *)lookup_result; + } + else { return NULL; } break; ``` I wrote a post about this class of issue in the past: https://alanwu.space/post/strict-aliasing/ ---------------------------------------- Bug #19248: TestGCCompact#test_moving_objects_between_size_pools test failure https://bugs.ruby-lang.org/issues/19248#change-101006 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0dev (2022-12-21 master 6af6857ecf) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Testing on Fedora Rawhide with commit:git|6af6857ecf, I observe the following error: ~~~ 1) Error: TestGCCompact#test_moving_objects_between_size_pools: NoMethodError: undefined method `>=' for nil:NilClass /builddir/build/BUILD/ruby-3.2.0-6af6857ecf/test/ruby/test_gc_compact.rb:278:in `
' /builddir/build/BUILD/ruby-3.2.0-6af6857ecf/test/ruby/test_gc_compact.rb:256:in `test_moving_objects_between_size_pools' /builddir/build/BUILD/ruby-3.2.0-6af6857ecf/tool/test/runner.rb:23:in `' /builddir/build/BUILD/ruby-3.2.0-6af6857ecf/test/runner.rb:16:in `require_relative' /builddir/build/BUILD/ruby-3.2.0-6af6857ecf/test/runner.rb:16:in `
' ~~~ Testing previously with commit:git|11acb7f7bc, everything was fine. I might just guess that this is related to commit:git|bfc66e07b7e0134dfa2041c311dc56941fe1caf0 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/