<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Regression: Referencing labels across asm blocks results in bad asm since 4.0.0"
   href="https://bugs.llvm.org/show_bug.cgi?id=34708">34708</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: Referencing labels across asm blocks results in bad asm since 4.0.0
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm@thecybershadow.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>///////////// test.cpp ////////////
bool test()
{
  __asm mov byte ptr [magic], 0x90;
  __asm {
    magic:
      nop
  };
}
///////////////////////////////////

$ clang -c -m32 -target i386-pc-windows-msvc18.0.0 test.cpp 
test.cpp:3:3: error: assembler label 'L__MSASMLABEL_.0__magic' can not be
undefined
  __asm mov byte ptr [magic], 0x90;
  ^
<inline asm>:2:2: note: instantiated into assembly here
        mov byte ptr L__MSASMLABEL_.0__magic, 0x90
        ^
1 error generated.

Looking at the emitted assembly, it looks like Clang/LLVM uses the
"L__MSASMLABEL_.0__magic" label when referring to the address of the "magic"
label, but actually defines the label with the name "L__MSASMLABEL_.1__magic".
In 3.9.1 "L__MSASMLABEL_.0__magic" is used throughout.

This pattern is necessary for MSVC compatibility with programs using
self-modifying code.</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>