[llvm-bugs] [Bug 25945] New: [x64] Improper CFI used for function clobbering FLAGS register

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 25 20:23:15 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25945

            Bug ID: 25945
           Summary: [x64] Improper CFI used for function clobbering FLAGS
                    register
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

consider:
define i64 @test_intervening_call(i64* %foo, i64 %bar, i64 %baz) {
  %cx = cmpxchg i64* %foo, i64 %bar, i64 %baz seq_cst seq_cst
  %v = extractvalue { i64, i1 } %cx, 0
  %p = extractvalue { i64, i1 } %cx, 1
  call void asm sideeffect "", "~{cc},~{dirflag},~{fpsr},~{flags}"()
  br i1 %p, label %t, label %f

t:
  ret i64 42

f:
  ret i64 0
}

this results in:
test_intervening_call:                  # @test_intervening_call
.Ltmp0:
.seh_proc test_intervening_call
# BB#0:
.Ltmp1:
        .seh_endprologue
        movq    %rdx, %rax
        lock            cmpxchgq        %r8, (%rcx)
        pushfq          <---- uh, oh...
        popq    %rax
        #APP
        #NO_APP
        pushq   %rax
        popfq
        jne     .LBB0_2
# BB#1:                                 # %t
        movl    $42, %eax
        retq
.LBB0_2:                                # %f
        xorl    %eax, %eax
        retq
        .seh_handlerdata

Notice how we are manipulating the stack pointer even though we don't have a
frame pointer.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151226/74648ab2/attachment.html>


More information about the llvm-bugs mailing list