<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [x64] Improper CFI used for function clobbering FLAGS register"
   href="https://llvm.org/bugs/show_bug.cgi?id=25945">25945</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[x64] Improper CFI used for function clobbering FLAGS register
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>