Bug 2125026 - gcc-12.2.1: "internal compiler error: in gt_pch_save" with PCH on i686
Summary: gcc-12.2.1: "internal compiler error: in gt_pch_save" with PCH on i686
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-09-07 19:13 UTC by Jarek Prokop
Modified: 2023-12-08 09:36 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jarek Prokop 2022-09-07 19:13:50 UTC
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.

Comment 1 Vít Ondruch 2022-12-08 14:03:43 UTC
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?

Comment 2 Dave Malcolm 2022-12-08 15:12:39 UTC
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.

Comment 3 Vít Ondruch 2022-12-08 15:29:03 UTC
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.

Comment 4 Vít Ondruch 2022-12-08 17:53:38 UTC
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.

Comment 5 Ben Cotton 2023-02-07 14:54:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 6 Vít Ondruch 2023-12-08 09:36:20 UTC
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


Note You need to log in before you can comment on or make changes to this bug.