[LLVMbugs] [Bug 6475] New: Inline asm bug with atomic_exchange_and_add

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 3 02:22:16 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=6475

           Summary: Inline asm bug with atomic_exchange_and_add
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: gonsolo at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Clang fails to compile the following reduce testcase:

inline int atomic_exchange_and_add( int * pw, int dv )
{
    int r;

    __asm__ __volatile__
    (
        "lock\n\t"
        "xadd %1, %0":
        "=m"( *pw ), "=r"( r ):
        "m"( *pw ), "1"( dv ):
        "memory", "cc"
    );

    return r;
}

void release() {
    int use_count_;
        if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) { }
}

with the following error:

Stack dump:
0.    Program arguments: /home/gonzo/bin/clang -cc1 -triple i386-pc-linux-gnu
-S -disable-free -disable-llvm-verifier -main-file-name bla3.cc
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -target-cpu
pentium4 -resource-dir /home/gonzo/lib/clang/1.1 -fmessage-length 177
-fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/cc-zTnd86.s -x c++ bla3.cc 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'X86 DAG->DAG Instruction Selection' on function
'@_Z23atomic_exchange_and_addPii'
clang: error: compiler command failed due to signal 11 (use -v to see
invocation)

This is clang version 02ebc and llvm version eb6e04 on Ubuntu 9.10.

-- 
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