https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126170
Bug ID: 126170
Summary: LTO ICE in copy_function_or_variable
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: abensonca at gcc dot gnu.org
Target Milestone: ---
Created attachment 64967
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64967&action=edit
tar archive containing source code and script to trigger the ICE
Since commit `c5367155` (trunk origin `3e281ae5`, "Fortran: Allow access to
coarray elements within modules", PR fortran/125051), link-time optimization
builds can result in an ICE. I was able to construct a reasonably minimal test
case that demonstrates this (see attached tar file, which consists of four
source files and a short bash script to trigger the ICE):
$ ./test.sh
during IPA pass: static-var
lto1: internal compiler error: in copy_function_or_variable, at
lto-streamer-out.cc:2638
0x23a9ed2 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0x80bf15 fancy_abort(char const*, int, char const*)
../../gcc/diagnostics/context.cc:1813
0x7cdaee copy_function_or_variable
../../gcc/lto-streamer-out.cc:2638
0x7cdaee lto_output()
../../gcc/lto-streamer-out.cc:2909
0xd28c0d write_lto
../../gcc/passes.cc:2781
0xd28c0d ipa_write_optimization_summaries(lto_symtab_encoder_d*, bool)
../../gcc/passes.cc:2980
0x85c2c2 stream_out
../../gcc/lto/lto.cc:181
0x85c2c2 stream_out_partitions_1
../../gcc/lto/lto.cc:233
0x85d416 stream_out_partitions
../../gcc/lto/lto.cc:284
0x85d416 lto_wpa_write_files
../../gcc/lto/lto.cc:422
0x85d416 do_whole_program_analysis
../../gcc/lto/lto.cc:601
0x85d416 lto_main()
../../gcc/lto/lto.cc:675
/carnegie/nobackup/users/abenson/tmp/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto1
-quiet -dumpbase ./prog.wpa -mtune=generic -march=x86-64 -g -g -fno-openmp
-fno-openacc -fno-pie -fcf-protection=none
-fltrans-output-list=/tmp/ccNnOyU0.ltrans.out -fwpa
-fresolution=/tmp/ccuDNAvG.res -flinker-output=exec @/tmp/cctzZTxR
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /carnegie/nobackup/users/abenson/tmp/bin/gfortran
returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
This seems to be a regression: no ICE with gcc version 16.0.1 20260416, but the
ICE is present in trunk today. Bisecting suggests that commit c5367155
introduced the regression.