[LLVMbugs] [Bug 12040] New: Cannot select: AtomicSwap

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 20 05:09:49 PST 2012


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

             Bug #: 12040
           Summary: Cannot select: AtomicSwap
           Product: new-bugs
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: pdhborges at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This bug affects: Apple clang version 3.1 (tags/Apple/clang-318.0.45) (based on
LLVM 3.1svn)

Kyoto's Cabinet (http://fallabs.com/kyotocabinet/) kcthread.cc/SpinLock
uses a void* pointer to embed several kinds of locks depending of the platform.

If __sync_bool_compare_and_swap is avaliable it uses 
__sync_bool_compare_and_swap(&opq_,0, 1) as a lock mechanism.

This won't compile in clang++ (but compiles on gcc) because the last elements
are int and &opq_ is void**. Casting the argumets to void* 

<pre>
__sync_bool_compare_and_swap(&opq_, (void*)0, (void*)1)
</pre>

makes clang accept the program but the backend crash with:

<pre>
fatal error: error in backend: Cannot select: 0x106ed2510: i64,ch = AtomicSwap
      0x7ff8084ce648, 0x106ed2610, 0x106eac710<Volatile LDST1[%1](align=8)>
      [ID=5]
  0x106ed2610: i64,ch = CopyFromReg 0x7ff8084ce648, 0x106eac010 [ORD=940]
[ID=4]
    0x106eac010: i64 = Register %vreg0 [ORD=940] [ID=1]
  0x106eac710: i64 = Constant<0> [ID=2]
</pre>

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