https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123295
Bug ID: 123295
Summary: [16 Regression] ICE: SIGSEGV in volatile_insn_p
(rtlanal.cc:2961) with -O -g2
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 63151
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63151&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -g2 testcase.c -Wno-psabi -wrapper
valgrind,-q,--num-callers=40
==9356== Invalid read of size 1
==9356== at 0x15B2C27: volatile_insn_p(rtx_def const*) (rtlanal.cc:2961)
==9356== by 0x525EF6F: ???
==9356== by 0x15B2C2B: volatile_insn_p(rtx_def const*) (rtlanal.cc:2961)
==9356== by 0x15B2C2B: volatile_insn_p(rtx_def const*) (rtlanal.cc:2961)
==9356== by 0x15B2C2B: volatile_insn_p(rtx_def const*) (rtlanal.cc:2961)
==9356== by 0x15B2C95: volatile_insn_p(rtx_def const*) (rtlanal.cc:2968)
==9356== by 0x15B2C2B: volatile_insn_p(rtx_def const*) (rtlanal.cc:2961)
==9356== by 0x14F23C9: reload_combine() (postreload.cc:1414)
==9356== by 0x14F3D20: reload_cse_regs (postreload.cc:67)
==9356== by 0x14F3D20: (anonymous
namespace)::pass_postreload_cse::execute(function*) (postreload.cc:2461)
==9356== by 0x14D7808: execute_one_pass(opt_pass*) (passes.cc:2648)
==9356== by 0x14D811F: execute_pass_list_1(opt_pass*) (passes.cc:2757)
==9356== by 0x14D8131: execute_pass_list_1(opt_pass*) (passes.cc:2758)
==9356== by 0x14D8131: execute_pass_list_1(opt_pass*) (passes.cc:2758)
==9356== by 0x14D8158: execute_pass_list(function*, opt_pass*)
(passes.cc:2768)
==9356== by 0x1054FD8: expand (cgraphunit.cc:1869)
==9356== by 0x1054FD8: cgraph_node::expand() (cgraphunit.cc:1822)
==9356== by 0x1056EBA: expand_all_functions (cgraphunit.cc:2052)
==9356== by 0x1056EBA: symbol_table::compile() [clone .part.0]
(cgraphunit.cc:2430)
==9356== by 0x105975D: compile (cgraphunit.cc:2340)
==9356== by 0x105975D: symbol_table::finalize_compilation_unit()
(cgraphunit.cc:2619)
==9356== by 0x1638562: compile_file() (toplev.cc:482)
==9356== by 0xE2F71F: do_compile (toplev.cc:2224)
==9356== by 0xE2F71F: toplev::main(int, char**) (toplev.cc:2389)
==9356== by 0xE30FBA: main (main.cc:39)
==9356== Address 0x2 is not stack'd, malloc'd or (recently) free'd
==9356==
during RTL pass: postreload
testcase.c: In function 'foo':
testcase.c:17:1: internal compiler error: Segmentation fault
17 | }
| ^
0x2c7af4d internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0x1637f2f crash_signal
/repo/gcc-trunk/gcc/toplev.cc:325
0x15b2c27 volatile_insn_p(rtx_def const*)
/repo/gcc-trunk/gcc/rtlanal.cc:2961
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.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20251223083305-r16-6351-g1f478b1d25bab8-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20251223083305-r16-6351-g1f478b1d25bab8-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251223 (experimental) (GCC)