https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99977
Bug ID: 99977
Summary: arm: ICE with __sync_bool_compare_and_swap and
-mcpu=cortex-m23
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
The following fails:
$ cat t1.c
int a[1];
void f() { __sync_bool_compare_and_swap(a, -1, 0); }
$ arm-eabi-gcc -c t1.c -mcpu=cortex-m23
t1.c: In function 'f':
t1.c:2:52: error: insn does not satisfy its constraints:
2 | void f() { __sync_bool_compare_and_swap(a, -1, 0); }
| ^
(jump_insn 29 28 30 (parallel [
(set (pc)
(if_then_else (ne (reg:SI 0 r0 [115])
(const_int -1 [0xffffffffffffffff]))
(label_ref 32)
(pc)))
(clobber (scratch:SI))
]) "t1.c":2:12 950 {cbranchsi4_scratch}
(int_list:REG_BR_PROB 536868 (nil))
-> 32)
during RTL pass: mach
t1.c:2:52: internal compiler error: in extract_constrain_insn, at recog.c:2671
0xcc1fd5 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/home/alecop01/toolchain/src/gcc/gcc/rtl-error.c:108
0xcc2006 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
/home/alecop01/toolchain/src/gcc/gcc/rtl-error.c:118
0xc91f2f extract_constrain_insn(rtx_insn*)
/home/alecop01/toolchain/src/gcc/gcc/recog.c:2671
0x1194ac1 note_invalid_constants
/home/alecop01/toolchain/src/gcc/gcc/config/arm/arm.c:18053
0x1194ac1 arm_reorg
/home/alecop01/toolchain/src/gcc/gcc/config/arm/arm.c:19195
0xcc1c9f execute
/home/alecop01/toolchain/src/gcc/gcc/reorg.c:4045
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
If we change the second argument to -8, we ICE in LRA instead:
$ cat t2.c
int a[1];
void f() { __sync_bool_compare_and_swap(a, -8, 0); }
$ arm-eabi-gcc -c t2.c -mcpu=cortex-m23
during RTL pass: reload
t2.c: In function 'f':
t2.c:2:52: internal compiler error: in curr_insn_transform, at
lra-constraints.c:4638
2 | void f() { __sync_bool_compare_and_swap(a, -8, 0); }
| ^
0xb7d9b4 curr_insn_transform
/home/alecop01/toolchain/src/gcc/gcc/lra-constraints.c:4638
0xb7ea1b lra_constraints(bool)
/home/alecop01/toolchain/src/gcc/gcc/lra-constraints.c:5169
0xb65c5c lra(_IO_FILE*)
/home/alecop01/toolchain/src/gcc/gcc/lra.c:2336
0xb1781c do_reload
/home/alecop01/toolchain/src/gcc/gcc/ira.c:5835
0xb1781c execute
/home/alecop01/toolchain/src/gcc/gcc/ira.c:6021
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.