https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128762
Bug ID: 128762
Summary: [17 Regression] ICE: SIGSEGV in mark_jump_label_1
(jump.cc:1059) with -O1 and
__sync_bool_compare_and_swap()
Product: gcc
Version: 17.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: aarch64-unknown-linux-gnu
Created attachment 66177
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66177&action=edit
reduced testcase
Compiler output:
$ aarch64-unknown-linux-gnu-gcc -O testcase.c -wrapper valgrind,-q
==3094268== Invalid read of size 1
==3094268== at 0x13477EF: mark_jump_label_1(rtx_def*, rtx_insn*, bool, bool)
(jump.cc:1059)
==3094268== by 0x1347C33: mark_jump_label_1(rtx_def*, rtx_insn*, bool, bool)
(jump.cc:1182)
==3094268== by 0x1347C33: mark_jump_label_1(rtx_def*, rtx_insn*, bool, bool)
(jump.cc:1182)
==3094268== by 0x1347C33: mark_jump_label_1(rtx_def*, rtx_insn*, bool, bool)
(jump.cc:1182)
==3094268== by 0x1347E89: mark_all_labels(rtx_insn*) (jump.cc:335)
==3094268== by 0x1348479: rebuild_jump_labels_1 (jump.cc:74)
==3094268== by 0x1348479: rebuild_jump_labels(rtx_insn*) (jump.cc:98)
==3094268== by 0xF2E850: (anonymous
namespace)::pass_expand::execute(function*) (cfgexpand.cc:7372)
==3094268== by 0x145DCCB: execute_one_pass(opt_pass*) (passes.cc:2651)
==3094268== by 0x145E6BF: execute_pass_list_1(opt_pass*) (passes.cc:2762)
==3094268== by 0x145E718: execute_pass_list(function*, opt_pass*)
(passes.cc:2773)
==3094268== by 0xF75EC5: expand (cgraphunit.cc:1875)
==3094268== by 0xF75EC5: cgraph_node::expand() (cgraphunit.cc:1828)
==3094268== by 0xF77EBA: expand_all_functions (cgraphunit.cc:2058)
==3094268== by 0xF77EBA: symbol_table::compile() [clone .part.0]
(cgraphunit.cc:2436)
==3094268== Address 0x2 is not stack'd, malloc'd or (recently) free'd
==3094268==
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:9:1: internal compiler error: Segmentation fault
9 | }
| ^
0x2e53059 internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0x15d6b0f crash_signal
/repo/gcc-trunk/gcc/toplev.cc:325
0x13477ef mark_jump_label_1
/repo/gcc-trunk/gcc/jump.cc:1059
0x1347c33 mark_jump_label_1
/repo/gcc-trunk/gcc/jump.cc:1182
0x1347c33 mark_jump_label_1
/repo/gcc-trunk/gcc/jump.cc:1182
0x1347c33 mark_jump_label_1
/repo/gcc-trunk/gcc/jump.cc:1182
0x1347e89 mark_all_labels
/repo/gcc-trunk/gcc/jump.cc:335
0x1348479 rebuild_jump_labels_1
/repo/gcc-trunk/gcc/jump.cc:74
0x1348479 rebuild_jump_labels(rtx_insn*)
/repo/gcc-trunk/gcc/jump.cc:98
0xf2e850 execute
/repo/gcc-trunk/gcc/cfgexpand.cc:7372
/repo/gcc-trunk/binary-trunk-20261115130302-r17-6290-g8816cba6f69999-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/17.0.0/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-20261115130302-r17-6290-g8816cba6f69999-checking-yes-rtl-df-extra-aarch64/bin/../lib/gcc/aarch64-unknown-linux-gnu/17.0.0/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c
-mlittle-endian -mabi=lp64 -O -o /tmp/ccQhfaxi.s
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.
$ aarch64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20261115130302-r17-6290-g8816cba6f69999-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/17.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-sysroot=/usr/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu
--with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld
--with-as=/usr/bin/aarch64-unknown-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20261115130302-r17-6290-g8816cba6f69999-checking-yes-rtl-df-extra-aarch64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20261115 (experimental) (GCC)