<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 - Crash when using .code32 in assembly with target x86_64-unknown-windows"
   href="https://bugs.llvm.org/show_bug.cgi?id=43203">43203</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash when using .code32 in assembly with target x86_64-unknown-windows
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.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>enhancement
          </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>js@alien8.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22462" name="attach_22462" title="Offending assembly file">attachment 22462</a> <a href="attachment.cgi?id=22462&action=edit" title="Offending assembly file">[details]</a></span>
Offending assembly file

I am trying to compile a PE binary on Linux that contains some 32-bit code
(it's an UEFI OS loader). The .S file containing this 32-bit code crashes
clang. See below for reproduction steps and stack dump.

This may be related to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - MCWinCOFFStreamer::EmitAssemblerFlag not implemented"
   href="show_bug.cgi?id=34752">https://bugs.llvm.org/show_bug.cgi?id=34752</a> and
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - [MC assembler] .code32, .code64 not supported"
   href="show_bug.cgi?id=8595">https://bugs.llvm.org/show_bug.cgi?id=8595</a>

Even if the feature is not implemented, I would not expect the compiler to
crash.

% clang-8 --version
clang version 8.0.0 (Fedora 8.0.0-1.fc30)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
 % cat pmjump.S
.code32
 % clang-8 -target x86_64-unknown-windows -m64 -c pmjump.S
Stack dump:
0.      Program arguments: /usr/bin/clang-8 -cc1as -triple
x86_64-unknown-windows-msvc19.11.0 -filetype obj -main-file-name pmjump.S
-target-cpu x86-64 -fdebug-compilation-dir /home/julian/tmp
-dwarf-debug-producer clang version 8.0.0 (Fedora 8.0.0-1.fc30)
-dwarf-version=4 -mrelocation-model pic -mincremental-linker-compatible -o
pmjump.o /tmp/pmjump-07eb43.s
#0 0x00007fa2b6c0906e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib64/libLLVM-8.so+0xabd06e)
#1 0x00007fa2b6c07014 llvm::sys::RunSignalHandlers()
(/lib64/libLLVM-8.so+0xabb014)
#2 0x00007fa2b6c07195 (/lib64/libLLVM-8.so+0xabb195)
#3 0x00007fa2b4f88f00 __restore_rt (/lib64/libc.so.6+0x37f00)
#4 0x00007fa2b6a3c0aa (/lib64/libLLVM-8.so+0x8f00aa)
#5 0x000055f4f9421370
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang integrated assembler command failed due to signal (use -v
to see invocation)
clang version 8.0.0 (Fedora 8.0.0-1.fc30)
Target: x86_64-unknown-windows-msvc
Thread model: posix
InstalledDir: /usr/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to  and include the
crash backtrace, preprocessed source, and associated run script.
clang-8: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/pmjump-753307.S
clang-8: note: diagnostic msg: /tmp/pmjump-753307.sh
clang-8: note: diagnostic msg:</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>