https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61713
Bug ID: 61713 Summary: 4.9 ICE when building c++ code with atomic functions for thumb1 target Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tony.wang at arm dot com The tool chain is built from: gcc version 4.9.1 20140630 (prerelease) [gcc-4_9-branch revision 212159] when compile below code, there will be ICE. int main() { typedef bool atomic_type; atomic_type c1; atomic_type c2; atomic_type c3(0); __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED); __atomic_test_and_set(&c1, __ATOMIC_RELAXED); __atomic_load_n(&c1, __ATOMIC_RELAXED); return 0; } Remember to save it as a c++ source file. For the debuggabe gcc, the ICE is: at1.cpp: In function 'int main()': at1.cpp:12:47: internal compiler error: in emit_move_insn, at expr.c:3609 __atomic_test_and_set(&c1, __ATOMIC_RELAXED); ^ 0x83c8240 emit_move_insn(rtx_def*, rtx_def*) /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/expr.c:3608 0x850f85d expand_atomic_test_and_set(rtx_def*, rtx_def*, memmodel) /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/optabs.c:7337 0x82ee779 expand_builtin_atomic_test_and_set /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/builtins.c:5552 0x82ee779 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/builtins.c:6781 0x83c3382 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/expr.c:10327 0x830bd38 expand_expr /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/expr.h:457 0x830bd38 expand_call_stmt /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:2275 0x830bd38 expand_gimple_stmt_1 /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:3170 0x830bd38 expand_gimple_stmt /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:3322 0x830c896 expand_gimple_basic_block /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:5162 0x830ebae gimple_expand_cfg /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:5741 0x830ebae execute /home/build/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/src/gcc/gcc/cfgexpand.c:5961 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. For the release version gcc, the ICE is: build@build-desktop:~/temp/gcc-arm-none-eabi-4_9-2014q3-20140701/case$ ../install-native/bin/arm-none-eabi-g++ -mthumb -O0 at1.cpp -S at1.cpp: In function 'int main()': at1.cpp:12:47: internal compiler error: in emit_move_insn, at expr.c:3609 __atomic_test_and_set(&c1, __ATOMIC_RELAXED); ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.