<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 - regcall related fatal error when targeting msvc abi"
   href="https://bugs.llvm.org/show_bug.cgi?id=48867">48867</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>regcall related fatal error when targeting msvc abi
          </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>Windows NT
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mizvekov@gmail.com
          </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>This one liner is enough to cause a fatal error during codegen:

´´´
[[gnu::regcall]] void a() { int b; }
´´´

Both 11 and trunk, when compiling with ´clang --target=x86_64-w64-windows-msvc
-c test.cc´

Workspace for convenience: <a href="https://godbolt.org/z/aMdG6e">https://godbolt.org/z/aMdG6e</a>

This is printed:

´´´
fatal error: error in backend: stack allocation size is not a multiple of 8
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-11 --target=x86_64-w64-windows-msvc -c test.cc
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'test.cc'.
4.      Running pass 'X86 Assembly Printer' on function '@"?a@@YwXXZ"'
 #0 0x00007f3dff92af8f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd0f8f)
 #1 0x00007f3dff9292f0 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbcf2f0)
 #2 0x00007f3dff92a6dd llvm::sys::CleanupOnSignal(unsigned long)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbd06dd)
 #3 0x00007f3dff86ec4a (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb14c4a)
 #4 0x00007f3dff86ebeb (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb14beb)
 #5 0x00007f3dff925dbe (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xbcbdbe)
 #6 0x00000000004134f2 (/usr/lib/llvm-11/bin/clang+0x4134f2)
 #7 0x00007f3dff87acaf llvm::report_fatal_error(llvm::Twine const&, bool)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb20caf)
 #8 0x00007f3e009ddbc6 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1c83bc6)
 #9 0x00007f3e00a072d9 llvm::MCStreamer::EmitWinCFIAllocStack(unsigned int,
llvm::SMLoc) (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x1cad2d9)
#10 0x00007f3e01a824f1 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x2d284f1)
#11 0x00007f3dfffe4b91 llvm::AsmPrinter::emitFunctionBody()
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x128ab91)
#12 0x00007f3e018bc126 (/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0x2b62126)
#13 0x00007f3dffbfe1ae
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xea41ae)
#14 0x00007f3dffa3a059 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xce0059)
#15 0x00007f3dffa3f603 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xce5603)
#16 0x00007f3dffa3a670 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xce0670)
#17 0x00007f3e054a76e6 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x164f6e6)
#18 0x00007f3e057649f6 (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x190c9f6)
#19 0x00007f3e0482f763 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x9d7763)
#20 0x00007f3e05dfb0c8 clang::FrontendAction::Execute()
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1fa30c8)
#21 0x00007f3e05db1641
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1f59641)
#22 0x00007f3e05e61200
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x2009200)
#23 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-11/bin/clang+0x4131bf)
#24 0x00000000004115fe (/usr/lib/llvm-11/bin/clang+0x4115fe)
#25 0x00007f3e05ae4732 (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8c732)
#26 0x00007f3dff86ebcd
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1+0xb14bcd)
#27 0x00007f3e05ae3c5f
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c8bc5f)
#28 0x00007f3e05abba7f
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c63a7f)
#29 0x00007f3e05abbc27
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c63c27)
#30 0x00007f3e05acf78c
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11+0x1c7778c)
#31 0x00000000004110a3 main (/usr/lib/llvm-11/bin/clang+0x4110a3)
#32 0x00007f3dfe88ed0a __libc_start_main ./csu/../csu/libc-start.c:308:16
´´´</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>