[LLVMbugs] [Bug 14583] New: Double width CAS problem

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 12 00:13:55 PST 2012


             Bug #: 14583
           Summary: Double width CAS problem
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nruslan_devel at yahoo.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Compiler crashes when I am trying to use double-width CAS 128 bit for x86_64
(C11, O2). (Note that CAS 64 bit for x86 seems to work fine.)

Test example:
void test_func(_Atomic(__uint128_t) *a, __uint128_t b, __uint128_t c)
    __c11_atomic_compare_exchange_strong(a, &b, c, __ATOMIC_SEQ_CST,

int main()
    _Atomic(__uint128_t) val;
    __c11_atomic_init(&val, 0);
    test_func(&val, 0, 3);
    return 0;

clang -std=c11 -Wall -O2 test.c

Crash message:
0  libLLVM-3.1.so.1 0x00007f4449a9efbf
1  libLLVM-3.1.so.1 0x00007f4449a9f581
2  libpthread.so.0  0x00007f4448bb7cb0
3  libLLVM-3.1.so.1 0x00007f444996272d
4  libLLVM-3.1.so.1 0x00007f4449972911
5  libLLVM-3.1.so.1 0x00007f444997e8d2
6  libLLVM-3.1.so.1 0x00007f444998115e llvm::SelectionDAG::LegalizeTypes() +
7  libLLVM-3.1.so.1 0x00007f4449a2bd49
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 233
8  libLLVM-3.1.so.1 0x00007f4449a2daf3
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1715
9  libLLVM-3.1.so.1 0x00007f4449a2ea96
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 678
10 libLLVM-3.1.so.1 0x00007f444958bc25
llvm::FPPassManager::runOnFunction(llvm::Function&) + 501
11 libLLVM-3.1.so.1 0x00007f444958bcc3
llvm::FPPassManager::runOnModule(llvm::Module&) + 51
12 libLLVM-3.1.so.1 0x00007f444958b8d9
llvm::MPPassManager::runOnModule(llvm::Module&) + 457
13 libLLVM-3.1.so.1 0x00007f444958b9ef
llvm::PassManagerImpl::run(llvm::Module&) + 111
14 clang            0x00000000006c2937
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 1975
15 clang            0x00000000006c08c0
16 clang            0x00000000007f2edf clang::ParseAST(clang::Sema&, bool,
bool) + 447
17 clang            0x000000000059e981
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 273
18 clang            0x000000000058767a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1082
19 clang            0x000000000058015a cc1_main(char const**, char const**,
char const*, void*) + 6650
20 clang            0x000000000057d567 main + 615
21 libc.so.6        0x00007f44482f476d __libc_start_main + 237
22 clang            0x000000000057e619
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -disable-free -disable-llvm-verifier -main-file-name test.c
-mrelocation-model static -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.22 -momit-leaf-frame-pointer
-resource-dir /usr/bin/../lib/clang/3.1 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.1/include -internal-isystem
/usr/include/clang/3.1/include/ -internal-externc-isystem 
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include -O2 -Wall -std=c11
-fdebug-compilation-dir /home/ruslan -ferror-limit 19 -fmessage-length 80
-mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/test-r0PLhr.o -x c test.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'test.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/test-MuvyIv.i
clang: note: diagnostic msg: /tmp/test-MuvyIv.sh

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list