From: "peterzhu2118 (Peter Zhu) via ruby-core" Date: 2023-01-04T22:02:27+00:00 Subject: [ruby-core:111631] [Ruby master Bug#19248] TestGCCompact#test_moving_objects_between_size_pools test failure Issue #19248 has been updated by peterzhu2118 (Peter Zhu). Thanks to @mtasaka and @vo.x for debugging this further! Using this information, I think this is a bug in GCC. Here's what I did: - I can confirm that I can reproduce this bug on Ubuntu 22.04 and GCC 11.3.0 with: ``` CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' ``` - I noticed during debugging the function [`rb_shape_traverse_from_new_root`](https://github.com/ruby/ruby/blob/837ef8911c638c3e2bdb6af710de7c1fac7b5f90/shape.c#L448) had seemingly impossible behaviour. I confirm that if I disable optimizations on that function, then test passes as expected. ```c #pragma GCC push_options #pragma GCC optimize ("O0") rb_shape_t * rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *dest_shape) { // ... } #pragma GCC pop_options ``` - I further isolated it down by setting `CFLAGS='-flto=auto'`, which causes Ruby to segfault. - Interestingly, disabling optimizations (`CFLAGS='-O0 -flto=auto'`) causes the test to pass. As such, I think there's an issue with `-flto` that causes bugs in Ruby. ---------------------------------------- Bug #19248: TestGCCompact#test_moving_objects_between_size_pools test failure https://bugs.ruby-lang.org/issues/19248#change-101003 * 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/