<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 --- - OSX thread_local: Bad machine code: Using an undefined physical register"
   href="https://llvm.org/bugs/show_bug.cgi?id=27062">27062</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>OSX thread_local: Bad machine code: Using an undefined physical register
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>aizatsky@chromium.org
          </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>On r264341

$ cat ./FuzzerTraceState-40081e.cpp
thread_local bool TraceStateIsMyThread;

$ clang++ -cc1 -triple x86_64-apple-macosx10.7.0 -emit-obj -std=c++11
-stack-protector 3 -O2 FuzzerTraceState-40081e.cpp



# Machine code for function _ZTW20TraceStateIsMyThread: Post SSA
Frame Objects:
  fi#0: size=8, align=8, at location [SP+8]

BB#0: derived from LLVM BB %0
    Live Ins: %RBX %R12 %R13 %R14 %R15 %RCX %RDX %RSI %R8 %R9 %R10 %R11
        %vreg0<def> = LOAD_STACK_GUARD; mem:LD8[@__stack_chk_guard](invariant)
GR64:%vreg0
        MOV64mr <fi#0>, 1, %noreg, 0, %noreg, %vreg0; mem:Volatile
ST8[FixedStack0] GR64:%vreg0
        ADJCALLSTACKDOWN64 0, 0, %RSP<imp-def,dead>, %EFLAGS<imp-def,dead>,
%RSP<imp-use>
        %RDI<def> = MOV64rm %RIP, 0, %noreg, <ga:@TraceStateIsMyThread>[TF=21],
%noreg
        CALL64m %RDI<kill>, 1, %noreg, 0, %noreg, <regmask %BH %BL %BP %BPL %BX
%CH %CL %CX %DH %DL %DX %EBP %EBX %ECX %EDX %ESI %RBP %RBX %RCX %RDX %RSI %SI
%SIL %R8 %R9 %R10 %R11 %R12 %R13 %R14 %R15 %R8B %R9B
 %R10B %R11B %R12B %R13B %R14B %R15B %R8D %R9D %R10D %R11D %R12D %R13D %R14D
%R15D %R8W %R9W %R10W %R11W %R12W %R13W %R14W %R15W>, %RSP<imp-use>,
%RAX<imp-def>
        ADJCALLSTACKUP64 0, 0, %RSP<imp-def,dead>, %EFLAGS<imp-def,dead>,
%RSP<imp-use>
        %vreg1<def> = COPY %RAX<kill>; GR64:%vreg1
        CMP64rm %vreg0, <fi#0>, 1, %noreg, 0, %noreg, %EFLAGS<imp-def>;
mem:Volatile LD8[FixedStack0] GR64:%vreg0
        JNE_1 <BB#1>, %EFLAGS<imp-use,kill>
        JMP_1 <BB#2>
    Successors according to CFG: BB#2(0x7ffff800 / 0x80000000 = 100.00%)
BB#1(0x00000800 / 0x80000000 = 0.00%)

BB#1: derived from LLVM BB %0
    Predecessors according to CFG: BB#0
        ADJCALLSTACKDOWN64 0, 0, %RSP<imp-def,dead>, %EFLAGS<imp-def,dead>,
%RSP<imp-use>
        CALL64pcrel32 <es:__stack_chk_fail>, <regmask %BH %BL %BP %BPL %BX %EBP
%EBX %RBP %RBX %R12 %R13 %R14 %R15 %R12B %R13B %R14B %R15B %R12D %R13D %R14D
%R15D %R12W %R13W %R14W %R15W>, %RSP<imp-use>, %RSP<i
mp-def>
        ADJCALLSTACKUP64 0, 0, %RSP<imp-def,dead>, %EFLAGS<imp-def,dead>,
%RSP<imp-use>

BB#2: derived from LLVM BB %0
    Predecessors according to CFG: BB#0
        %RAX<def> = COPY %vreg1; GR64:%vreg1
        RET 0, %RAX<kill>, %RBX, %R12<kill>, %R13<kill>, %R14<kill>,
%R15<kill>, %RCX<kill>, %RDX<kill>, %RSI<kill>, %R8<kill>, %R9<kill>,
%R10<kill>, %R11<kill>

# End machine code for function _ZTW20TraceStateIsMyThread.

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 2:   %RBX

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 3:   %R12<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 4:   %R13<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 5:   %R14<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 6:   %R15<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 7:   %RCX<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 8:   %RDX<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 9:   %RSI<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 10:   %R8<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 11:   %R9<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 12:   %R10<kill>

*** Bad machine code: Using an undefined physical register ***
- function:    _ZTW20TraceStateIsMyThread
- basic block: BB#2  (0x68725b0)
- instruction: RET
- operand 13:   %R11<kill>
fatal error: error in backend: Found 12 machine code errors.</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>