https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118717

            Bug ID: 118717
           Summary: =gcc-15.0.1_pre20250126 produces ICE with ruby-3.4.1
                    when lto is used: ractor.c:592:1: internal compiler
                    error: SSA corruption
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ted.d.rodgers at gmail dot com
  Target Milestone: ---

Linking two pre-compiled objects from  ruby-3.4.1 with lot enabled produces:
SSA corruption.   Compiler error does not occur if the two objects were built
without enabling lto.


x86_64-pc-linux-gnu-gcc -shared -Wl,-O1 -Wl,--as-needed
-Wl,-z,pack-relative-relocs -Wl,-soname,libruby34.so.3.4 
-fstack-protector-strong -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs
ractor.o thread.o -o libruby34.so.3.4.1

Unable to coalesce ssa_names 33 and 35 which are marked as MUST COALESCE.
_ec_33(ab) and  _ec_35(ab)
during RTL pass: expand
../../var/tmp/portage/dev-lang/ruby-3.4.1-r1/work/ruby-3.4.1/ractor.c: In
function ‘ractor_check_ints.constprop’:
../../var/tmp/portage/dev-lang/ruby-3.4.1-r1/work/ruby-3.4.1/ractor.c:592:1:
internal compiler error: SSA corruption
  592 | ractor_check_ints(rb_execution_context_t *ec, rb_ractor_t *cr,
ractor_sleep_cleanup_function cf_func, void *cf_data)
      | ^
0x5598c7ae8234 internal_error(char const*, ...)
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/diagnostic-global-context.cc:517
0x5598c61b8565 fail_abnormal_edge_coalesce
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/tree-ssa-coalesce.cc:1012
0x5598c61b8565 coalesce_partitions
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/tree-ssa-coalesce.cc:1444
0x5598c61b94ad coalesce_ssa_name(_var_map*)
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/tree-ssa-coalesce.cc:1898
0x5598c6105d61 remove_ssa_form
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/tree-outof-ssa.cc:1069
0x5598c6105d61 rewrite_out_of_ssa(ssaexpand*)
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/tree-outof-ssa.cc:1357
0x5598c5871ed3 execute
       
/usr/src/debug/sys-devel/gcc-15.0.1_pre20250126/gcc-15-20250126/gcc/cfgexpand.cc:6955
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
make: *** [/tmp/ccolZslg.mk:2: /tmp/ccGLHZqh.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status



''''
Fails (lto enabled):

x86_64-pc-linux-gnu-gcc -march=native -O3 -flto -mprefer-vector-width=512
-fno-vect-cost-model -pipe -fno-omit-frame-pointer -fno-strict-aliasing -fPIC 
-fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard    -o
thread.o -c thread.i

x86_64-pc-linux-gnu-gcc -march=native -O3 -flto -mprefer-vector-width=512
-fno-vect-cost-model -pipe -fno-omit-frame-pointer -fno-strict-aliasing -fPIC 
-fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -o
ractor.o -c ractor.i



x86_64-pc-linux-gnu-gcc -shared -Wl,-O1 -Wl,--as-needed
-Wl,-z,pack-relative-relocs -Wl,-soname,libruby34.so.3.4 
-fstack-protector-strong -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs
ractor.o thread.o -o libruby34.so.3.4.1



''''
Works (no lto): 

x86_64-pc-linux-gnu-gcc -march=native -O3 -mprefer-vector-width=512
-fno-vect-cost-model -pipe -fno-omit-frame-pointer -fno-strict-aliasing -fPIC 
-fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard    -o
thread.o -c thread.i

x86_64-pc-linux-gnu-gcc -march=native -O3 -mprefer-vector-width=512
-fno-vect-cost-model -pipe -fno-omit-frame-pointer -fno-strict-aliasing -fPIC 
-fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -o
ractor.o -c ractor.i


x86_64-pc-linux-gnu-gcc -shared -Wl,-O1 -Wl,--as-needed
-Wl,-z,pack-relative-relocs -Wl,-soname,libruby34.so.3.4 
-fstack-protector-strong -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs
ractor.o thread.o -o libruby34.so.3.4.1

Reply via email to