User account creation filtered due to spam.

Bug 56964 - ICE with -fno-sync-libcalls when target lacks atomic operations
Summary: ICE with -fno-sync-libcalls when target lacks atomic operations
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-15 10:44 UTC by Mans Rullgard
Modified: 2014-06-17 21:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mans Rullgard 2013-04-15 10:44:56 UTC
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.
Comment 1 rwahl 2014-06-17 19:34:54 UTC
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.
Comment 2 rwahl 2014-06-17 21:31:51 UTC
Just found out that the mentioned hangs in my last comment were caused by configuring gcc with --disable-checking so the asserts were removed.