| Issue |
75934
|
| Summary |
clang crashes in release mode due to force inlined function with _malloca into a coroutine on windows
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
CurTInq
|
It seems to be known issue since backend emits "Coroutines cannot handle non static allocas yet".
The question is why it crashes the compiler instead of emitting an error?
```
1>fatal error: error in backend: Coroutines cannot handle non static allocas yet
1>PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
1>Stack dump:
1>0. Program arguments: "D:\\\LLVM\\bin\\clang-cl.exe" @C:\\Users\\epicuser\\AppData\\Local\\Temp\\MSBuildTempepicuser\\tmpe12c6c65da1147928d1d8048079d74f1.rsp
1>1. <eof> parser at end of file
1>2. Optimizer
1>3. While splitting coroutine @"?f@@YA?AUJob@@XZ"
1>Exception Code: 0xE0000046
1> #0 0x00007ffa328a450c (C:\WINDOWS\system32\KERNELBASE.dll+0x450c)
1> #1 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x257847a D:\LLVM\bin\clang-cl.exe 0x25785d9
1> #2 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x2472633 D:\LLVM\bin\clang-cl.exe 0x2588ec9
1> #3 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x2403874 D:\LLVM\bin\clang-cl.exe 0x3ffa692
1> #4 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x3ff1bbf D:\LLVM\bin\clang-cl.exe 0x3a6b039
1> #5 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x1fa08fa D:\LLVM\bin\clang-cl.exe 0x1fa054b
1> #6 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x223d092 D:\LLVM\bin\clang-cl.exe 0x223cd4b
1> #7 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x21f1040 D:\LLVM\bin\clang-cl.exe 0x21f0dfb
1> #8 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x2098947 D:\LLVM\bin\clang-cl.exe 0x408531
1> #9 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x33d919 D:\LLVM\bin\clang-cl.exe 0x79d96b
1>#10 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x79d791 D:\LLVM\bin\clang-cl.exe 0x33d919
1>#11 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x339b38 D:\LLVM\bin\clang-cl.exe 0x330f72
1>#12 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x1ec363e D:\LLVM\bin\clang-cl.exe 0x2340aa3
1>#13 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x30477 D:\LLVM\bin\clang-cl.exe 0x2ff17
1>#14 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x2c80d D:\LLVM\bin\clang-cl.exe 0x2b2e6
1>#15 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x29ade D:\LLVM\bin\clang-cl.exe 0x127100d
1>#16 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x724035 D:\LLVM\bin\clang-cl.exe 0x723e38
1>#17 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x137368 D:\LLVM\bin\clang-cl.exe 0x136d1c
1>#18 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x136837 D:\LLVM\bin\clang-cl.exe 0x12fc30
1>#19 0x00007ff6bbc2847a D:\LLVM\bin\clang-cl.exe 0x12eec1 D:\LLVM\bin\clang-cl.exe 0x23c6720
1>#20 0x00007ff6bbc2847a (D:\LLVM\bin\clang-cl.exe+0x257847a)
1>#21 0x00007ff6bbc285d9 (D:\LLVM\bin\clang-cl.exe+0x25785d9)
1>0x00007FFA328A450C, C:\WINDOWS\system32\KERNELBASE.dll(0x00007FFA328A0000) + 0x450C byte(s), RaiseException() + 0x6C byte(s)
1>0x00007FF6BBC2847A, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x257847A byte(s)
1>0x00007FF6BBC285D9, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x25785D9 byte(s)
1>0x00007FF6BBB22633, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2472633 byte(s)
1>0x00007FF6BBC38EC9, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2588EC9 byte(s)
1>0x00007FF6BBAB3874, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2403874 byte(s)
1>0x00007FF6BD6AA692, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x3FFA692 byte(s)
1>0x00007FF6BD6A1BBF, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x3FF1BBF byte(s)
1>0x00007FF6BD11B039, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x3A6B039 byte(s)
1>0x00007FF6BB6508FA, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x1FA08FA byte(s)
1>0x00007FF6BB65054B, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x1FA054B byte(s)
1>0x00007FF6BB8ED092, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x223D092 byte(s)
1>0x00007FF6BB8ECD4B, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x223CD4B byte(s)
1>0x00007FF6BB8A1040, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x21F1040 byte(s)
1>0x00007FF6BB8A0DFB, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x21F0DFB byte(s)
1>0x00007FF6BB748947, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2098947 byte(s)
1>0x00007FF6B9AB8531, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x408531 byte(s)
1>0x00007FF6B99ED919, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x33D919 byte(s)
1>0x00007FF6B9E4D96B, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x79D96B byte(s)
1>0x00007FF6B9E4D791, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x79D791 byte(s)
1>0x00007FF6B99ED919, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x33D919 byte(s)
1>0x00007FF6B99E9B38, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x339B38 byte(s)
1>0x00007FF6B99E0F72, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x330F72 byte(s)
1>0x00007FF6BB57363E, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x1EC363E byte(s)
1>0x00007FF6BB9F0AA3, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2340AA3 byte(s)
1>0x00007FF6B96E0477, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x30477 byte(s)
1>0x00007FF6B96DFF17, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2FF17 byte(s)
1>0x00007FF6B96DC80D, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2C80D byte(s)
1>0x00007FF6B96DB2E6, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x2B2E6 byte(s)
1>0x00007FF6B96D9ADE, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x29ADE byte(s)
1>0x00007FF6BA92100D, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x127100D byte(s)
1>0x00007FF6B9DD4035, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x724035 byte(s)
1>0x00007FF6B9DD3E38, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x723E38 byte(s)
1>0x00007FF6B97E7368, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x137368 byte(s)
1>0x00007FF6B97E6D1C, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x136D1C byte(s)
1>0x00007FF6B97E6837, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x136837 byte(s)
1>0x00007FF6B97DFC30, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x12FC30 byte(s)
1>0x00007FF6B97DEEC1, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x12EEC1 byte(s)
1>0x00007FF6BBA76720, D:\LLVM\bin\clang-cl.exe(0x00007FF6B96B0000) + 0x23C6720 byte(s)
1>0x00007FFA33031412, C:\WINDOWS\system32\KERNEL32.DLL(0x00007FFA33030000) + 0x1412 byte(s), BaseThreadInitThunk() + 0x22 byte(s)
1>0x00007FFA353E5504, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FFA353D0000) + 0x15504 byte(s), RtlUserThreadStart() + 0x34 byte(s)
1>clang-cl : error : clang frontend command failed with exit code 70 (use -v to see invocation)
1>clang version 17.0.6
1>Target: x86_64-pc-windows-msvc
1>Thread model: posix
```
minimized reproducible example:
```cpp
#include <coroutine>
#include <exception>
#include <cstdlib>
struct SimplePromise
{
std::suspend_never initial_suspend() noexcept { return {}; }
std::suspend_never final_suspend() noexcept { return {}; }
inline auto get_return_object() noexcept;
void return_void() noexcept {}
[[noreturn]] void unhandled_exception() const noexcept { std::terminate(); }
};
struct Job
{
using promise_type = SimplePromise;
using handle_type = std::coroutine_handle<promise_type>;
constexpr Job(handle_type h) noexcept : h(h) {}
bool await_ready() const noexcept { return !h || h.done(); }
std::coroutine_handle<> await_suspend([[maybe_unused]] std::coroutine_handle<>) noexcept { return h; }
void await_resume() noexcept {}
handle_type h;
};
inline auto SimplePromise::get_return_object() noexcept { return Job{ std::coroutine_handle<SimplePromise>::from_promise(*this) }; }
// the actual code now
Job foo();
Job bar();
Job gaz();
bool some_func(void * pMemory);
__forceinline bool funny_function()
{
void * some_memory_we_do_something_with = _malloca(rand() % 1337);
bool result = some_func(some_memory_we_do_something_with);
_freea(some_memory_we_do_something_with);
return result;
}
Job f()
{
co_await foo();
bool yes = funny_function();
if (yes) co_await bar();
co_await gaz();
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs