Use of __atomic_* functions when compiling for a target without atomic operations (e.g. ARMv6) while specifying -fno-sync-libcalls gives an ICE instead of a proper error message. $ cat foo.c int *x; void foo(void) { __atomic_test_and_set(x, 0); } $ arm-unknown-linux-gnueabi-gcc-4.8.0 -c foo.c -march=armv6 -fno-sync-libcalls foo.c: In function 'foo': foo.c:4:26: internal compiler error: in emit_move_insn, at expr.c:3486 __atomic_test_and_set(x, 0); ^ Please submit a full bug report, with preprocessed source if appropriate. This happens for any target without atomic operations in hardware.
I can reproduce this too when building multilib cross compiler: cat gcc-4.8.3/build-arm-pp-linux-uclibcgnueabi/arm-pp-linux-uclibcgnueabi/libatomic/config.log ... configure:12468: checking for __atomic_test_and_set for size 1 configure:12487: /home/nb/builds/toolchain-010/tmp_cross/build/gcc-4.8.3/build-arm-pp-linux-uclibcgnueabi/./gcc/xgcc -B/home/nb/builds/toolchain-010/tmp_cross/build/gcc-4.8.3/build-arm-pp-linux-uclibcgnueabi/./gcc/ -B/home/nb/builds/toolchain-010/tmp_cross/build_root_2//bin/ -B/home/nb/builds/toolchain-010/tmp_cross/build_root_2//lib/ -isystem /home/nb/builds/toolchain-010/tmp_cross/build_root_2//arm-pp-linux-uclibcgnueabi/include --sysroot=/home/nb/builds/toolchain-010/tmp_cross/build_root_2//arm-pp-linux-uclibcgnueabi -o conftest -Os -fno-sync-libcalls conftest.c >&5 conftest.c: In function 'main': conftest.c:40:27: internal compiler error: Segmentation fault __atomic_test_and_set(x, 0); ^ Please submit a full bug report, ... Under different build circumstances the build of conftest.c even just hangs which was my original problem I was trying to solve and it took me half a day to dig around and find that bug report.
Just found out that the mentioned hangs in my last comment were caused by configuring gcc with --disable-checking so the asserts were removed.
Fixed in GCC 4.9.x and GCC 5+. by the patch which fixed PR 61713. It is an exact dup really. *** This bug has been marked as a duplicate of bug 61713 ***