Description of problem: Ruby 3.1.2 includes JIT which uses GCC and PCH in the background. Recently, Ruby tests executed as part of the build started failing with an internal compiler error on trying to compile the common header. Log of the failures: ~~~ 1) Failure: TestJIT#test_compile_insn_opt_calc [/builddir/build/BUILD/ruby-3.1.2/test/ruby/test_jit.rb:514]: Expected 1 times of JIT success, but succeeded 0 times. script: """ p proc { 4 + 2 }.call """ stderr: """ /builddir/build/BUILD/ruby-3.1.2/.ext/include/i386-linux/rb_mjit_min_header-3.1.2.h:26768:9: internal compiler error: in gt_pch_save, at ggc-common.cc:671 26768 | #pragma GCC diagnostic pop | ^~~ Please submit a full bug report, with preprocessed source. See <http://bugzilla.redhat.com/bugzilla> for instructions. The bug is not reproducible, so it is likely a hardware or OS problem. MJIT warning: Making precompiled header failed on compilation. Stopping MJIT worker... MJIT warning: timed out to wait for JIT finish """ . <1> expected but was <0>. 2) Failure: TestJIT#test_compile_insn_pop [/builddir/build/BUILD/ruby-3.1.2/test/ruby/test_jit.rb:295]: Expected 1 times of JIT success, but succeeded 0 times. script: """ p proc { a = false b = 1 a || b }.call """ stderr: """ /builddir/build/BUILD/ruby-3.1.2/.ext/include/i386-linux/rb_mjit_min_header-3.1.2.h:26768:9: internal compiler error: in gt_pch_save, at ggc-common.cc:671 26768 | #pragma GCC diagnostic pop | ^~~ Please submit a full bug report, with preprocessed source. See <http://bugzilla.redhat.com/bugzilla> for instructions. The bug is not reproducible, so it is likely a hardware or OS problem. MJIT warning: Making precompiled header failed on compilation. Stopping MJIT worker... MJIT warning: timed out to wait for JIT finish """ . <1> expected but was <0>. 3) Failure: TestJIT#test_compile_insn_blockparam [/builddir/build/BUILD/ruby-3.1.2/test/ruby/test_jit.rb:102]: Expected 2 times of JIT success, but succeeded 0 times. script: """ def foo(&b) a = b b = 2 a.call + 2 end print foo { 1 } """ stderr: """ /builddir/build/BUILD/ruby-3.1.2/.ext/include/i386-linux/rb_mjit_min_header-3.1.2.h:26768:9: internal compiler error: in gt_pch_save, at ggc-common.cc:671 26768 | #pragma GCC diagnostic pop | ^~~ Please submit a full bug report, with preprocessed source. See <http://bugzilla.redhat.com/bugzilla> for instructions. The bug is not reproducible, so it is likely a hardware or OS problem. MJIT warning: Making precompiled header failed on compilation. Stopping MJIT worker... MJIT warning: timed out to wait for JIT finish """ . <2> expected but was <0>. ~~~ Version-Release number of selected component (if applicable): gcc-12.2.1 on Fedora 36, 38 (Rawhide currently) and probably F37 on i686 build architecture. How reproducible: More or less all the time, Fedora 36 seems to fail most often. The quantity of failed tests seem to differ, however at least one always fails. Steps to Reproduce: ~~~ $ cd /builddir/build/BUILD/ruby-3.1.2/ $ make test-all TESTS=test/ruby/test_jit.rb $ make test-all TESTS=test/ruby/test_jit.rb ./revision.h unchanged Run options: --seed=29223 "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes --name=!/memory_leak/ # Running tests: [ 49/102] TestJIT#test_compile_insn_definemethod_definesmethod = 0.58 s 1) Failure: TestJIT#test_compile_insn_definemethod_definesmethod [/builddir/build/BUILD/ruby-3.1.2/test/ruby/test_jit.rb:215]: Expected 3 times of JIT success, but succeeded 0 times. script: """ print 1.times.map { def method_definition 'hello' end def self.smethod_definition 'world' end method_definition + smethod_definition }.join """ stderr: """ /builddir/build/BUILD/ruby-3.1.2/.ext/include/i386-linux/rb_mjit_min_header-3.1.2.h:26768:9: internal compiler error: in gt_pch_save, at ggc-common.cc:671 26768 | #pragma GCC diagnostic pop | ^~~ Please submit a full bug report, with preprocessed source. See <http://bugzilla.redhat.com/bugzilla> for instructions. The bug is not reproducible, so it is likely a hardware or OS problem. MJIT warning: Making precompiled header failed on compilation. Stopping MJIT worker... MJIT warning: timed out to wait for JIT finish """ . <3> expected but was <0>. Finished tests in 47.109738s, 2.1652 tests/s, 11.5051 assertions/s. 102 tests, 542 assertions, 1 failures, 0 errors, 3 skips ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [i386-linux] ~~~ Actual results: MJIT tests fail. Expected results: MJIT tests pass. Additional info: From the fedora-f36-i386 local mock environment: ``` $ rpm -qa gcc gcc-12.2.1-1.fc36.i686 ``` Examples of failed builds: Failed F36 i686 build: https://koji.fedoraproject.org/koji/taskinfo?taskID=91731015 Failed F38 i686 build: https://koji.fedoraproject.org/koji/taskinfo?taskID=91519662 Were there some changes to gcc-12.2.1 that could be related to this error? We started noticing these failures with the gcc-12.2.1.
This used to fail just occasionally. However, trying to build Ruby in Koji at least from last Friday Dec 2022-12-02, it fails always. This is interesting, because I was able to do the last official builds in between 2022-11-28 - 2022-11-30. GCC has not changed, most of the dependencies have not changes. But what changed is Kernel. Can Kernel influence this?
CCing vmakarov for his Ruby expertise. (In reply to Vít Ondruch from comment #1) > This used to fail just occasionally. However, trying to build Ruby in Koji > at least from last Friday Dec 2022-12-02, it fails always. This is > interesting, because I was able to do the last official builds in between > 2022-11-28 - 2022-11-30. GCC has not changed, most of the dependencies have > not changes. But what changed is Kernel. Can Kernel influence this? Getting the bug to show itself might depend on the addresses of data within the process, so things like address space randomization could affect that, or just kernel logic about where it places things like code vs data vs heap.
Just FTR, we were already facing issues with PCH in bug 1721553, but this time it looks different, it seems to affect just i686 and now it got suddenly much worse.
Just FTR, I have tried F37 build and it passed on the first try. So Rawhide might be more problematic then F37 for some reason.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.
This does not seem to be issue for Ruby 3.2 (or more recent GCC?), because the test cases in question are re-enabled by mistake (the test_jit.rb was renamed upstream [1] without us noticing) and I am not aware about any huge issues [2]. [1]: https://github.com/ruby/ruby/commit/ead96e7b44b98bef4896d836239345012821f1d2 [2]: https://koschei.fedoraproject.org/package/ruby?collection=f38