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

           Summary: x86 asm earlyclobber not respected
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Register Allocator
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=4422)
 --> (http://llvm.org/bugs/attachment.cgi?id=4422)
unminimized source

Using checker-236 and

> ~/checker-236/bin/clang -O3 -mdynamic-no-pic -m32 -fomit-frame-pointer -S 
> cabac_residual.i

the first inline asm compiled has its first input and output both assigned to
eax:
_decode_cabac_residual_internal:
...
LBB1_6:
...
    ## InlineAsm Start
    movl 4(%edi), %esi            
    movl 0(%edi), %ebx            
    movzbl (%eax)    , %eax   

This is compiled from:
static inline int get_cabac_inline(CABACContext *c, uint8_t *const state) {
    int bit;

    asm volatile (
    "movl 4(%2), %%esi            \n\t"
    "movl 0(%2), %%ebx            \n\t"
    "movzbl (%1)    , %0                                     \n\t"
...
    : "=&a" (bit) : "r" (state), "r" (c) : "%ecx", "%ebx", "%edx", "%esi",
"memory");

bit is an earlyclobber, so it should be assigned eax and nothing else should.

This only seems to happen when inlined, so I was unable to minimize it very
far.
This causes ffmpeg (and therefore anything else including it) to miscompile and
crash on x86-32 in the H.264 decoder.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to