<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 - clang fails to build llvm-11.0.0 32-bit in 32-bit mode when XOP instructions are enabled"
   href="https://bugs.llvm.org/show_bug.cgi?id=48451">48451</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang fails to build llvm-11.0.0 32-bit in 32-bit mode when XOP instructions are enabled
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>markus@cs.wisc.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=24252" name="attach_24252" title="temp-015dcb.c">attachment 24252</a> <a href="attachment.cgi?id=24252&action=edit" title="temp-015dcb.c">[details]</a></span>
temp-015dcb.c

I was having trouble building llvm-11 with clang. I tried using clang 9-11 and
each failed with the same error. This is with the Gentoo-built packages, but
hopefully my repro is good enough.

The XOP instructions are enabled when using -march=native on an AMD fam15h CPU,
such as what I have. These instructions aren't supported on any other family of
CPUs, not before or after fam15h. My workaround was to use `-march=native
-mno-xop`, so I got clang 11 to build after all.

Repro:

cat >test.c <<<EOF
int main(int argc, char**argv) {
  return __builtin_bitreverse64(argc);
}
EOF
clang -m32 -mxop -c test.c

libc++abi: terminating with uncaught exception of type std::length_error:
vector
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -m32 -mxop -c bug.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'bug.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
 #0 0x00007fcb37c4411c
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x17b411c)
 #1 0x00007fcb37c417a0 llvm::sys::RunSignalHandlers()
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x17b17a0)
 #2 0x00007fcb37c4320d llvm::sys::CleanupOnSignal(unsigned long)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x17b320d)
 #3 0x00007fcb37b6d3f3
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x16dd3f3)
 #4 0x00007fcb3d4624b0 __restore_rt (/lib64/libpthread.so.0+0x124b0)
 #5 0x00007fcb360a84f1 raise (/lib64/libc.so.6+0x384f1)
 #6 0x00007fcb36092536 abort (/lib64/libc.so.6+0x22536)
 #7 0x00007fcb363a6fbe (/usr/lib64/libc++abi.so.1+0x36fbe)
 #8 0x00007fcb363899a4 (/usr/lib64/libc++abi.so.1+0x199a4)
 #9 0x00007fcb363a60f3 (/usr/lib64/libc++abi.so.1+0x360f3)
#10 0x00007fcb363a8dc6 (/usr/lib64/libc++abi.so.1+0x38dc6)
#11 0x00007fcb363a8d70 (/usr/lib64/libc++abi.so.1+0x38d70)
#12 0x00007fcb36466545 (/usr/lib64/libc++.so.1+0xae545)
#13 0x00007fcb364746dd (/usr/lib64/libc++.so.1+0xbc6dd)
#14 0x00007fcb399c7dbc
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x3537dbc)
#15 0x00007fcb383183f3
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1e883f3)
#16 0x00007fcb382fab75
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1e6ab75)
#17 0x00007fcb38319f8f llvm::SelectionDAG::LegalizeTypes()
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1e89f8f)
#18 0x00007fcb38429a48 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1f99a48)
#19 0x00007fcb38429053
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1f99053)
#20 0x00007fcb38426190
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1f96190)
#21 0x00007fcb39925417
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x3495417)
#22 0x00007fcb37fb0efd
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x1b20efd)
#23 0x00007fcb37d9425c llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x190425c)
#24 0x00007fcb37d9bfe3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x190bfe3)
#25 0x00007fcb37d949e1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x19049e1)
#26 0x00007fcb3bf5120b clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::__1::unique_ptr<llvm::raw_pwrite_stream,
std::__1::default_delete<llvm::raw_pwrite_stream> >)
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x1fb120b)
#27 0x00007fcb3c23d516
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x229d516)
#28 0x00007fcb3af46854 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0xfa6854)
#29 0x00007fcb3cb29854 clang::FrontendAction::Execute()
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x2b89854)
#30 0x00007fcb3cab7211
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x2b17211)
#31 0x00007fcb3cb9f460
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x2bff460)
#32 0x0000000000214999 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm/11/bin/clang-11+0x214999)
#33 0x0000000000212efc (/usr/lib/llvm/11/bin/clang-11+0x212efc)
#34 0x00007fcb3c6f4172
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x2754172)
#35 0x00007fcb37b6cf7f
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/usr/lib/llvm/11/bin/../lib64/libLLVM-11libcxx.so+0x16dcf7f)
#36 0x00007fcb3c6f36e0
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__1::basic_string<char, std::__1::char_traits<char>,</span >
std::__1::allocator<char> >*, bool*) const
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x27536e0)
#37 0x00007fcb3c6be950
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x271e950)
#38 0x00007fcb3c6befd7
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&)
const (/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x271efd7)
#39 0x00007fcb3c6da2fb
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&)
(/usr/lib/llvm/11/bin/../lib64/libclang-cpp.so.11libcxx+0x273a2fb)
#40 0x00000000002123a2 main (/usr/lib/llvm/11/bin/clang-11+0x2123a2)
#41 0x00007fcb36093e5e __libc_start_main (/lib64/libc.so.6+0x23e5e)
#42 0x000000000020ef8a _start (/usr/lib/llvm/11/bin/clang-11+0x20ef8a)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0
Target: i386-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/11/bin
clang-11: note: diagnostic msg:
********************

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