<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115121>115121</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Assertion `F.hasFnAttribute(CORO_PRESPLIT_ATTR) && F.getFnAttribute(CORO_PRESPLIT_ATTR).getValueAsString() == UNPREPARED_FOR_SPLIT && "The frontend uses Swtich-Resumed ABI should emit " "\"coroutine.presplit\" attribute with value \"0\" for the " "coroutine."' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20,
clang:codegen,
crash-on-valid,
clang:frontend:fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
**This testcase is generated by a fuzzer.**
Compiler Explorer: [https://godbolt.org/z/d7eEsffbd](https://godbolt.org/z/d7eEsffbd)
This valid C++20 code will crash on Clang Assertion Trunk.
```cpp
int main() {
__builtin_coro_id(32, 0, 0, 0);
}
```
It seems that this goes back to clang-14.
Stack dump:
```
clang++: /root/llvm-project/llvm/lib/Transforms/Coroutines/CoroEarly.cpp:201: void {anonymous}::Lowerer::lowerEarlyIntrinsics(llvm::Function&): Assertion `F.isPresplitCoroutine() && "The frontend uses Switch-Resumed ABI should emit " "\"presplitcoroutine\" attribute for the coroutine."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1. <eof> parser at end of file
2. Optimizer
3. Running pass "coro-cond(coro-early,cgscc(coro-split),coro-cleanup,globaldce)" on module "<source>"
4. Running pass "coro-early" on module "<source>"
#0 0x0000000003be9e28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3be9e28)
#1 0x0000000003be7b2c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3be7b2c)
#2 0x0000000003b35468 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007e5743442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007e57434969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007e5743442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007e57434287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007e574342871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007e5743439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000005385ec4 (anonymous namespace)::Lowerer::lowerEarlyIntrinsics(llvm::Function&) CoroEarly.cpp:0:0
#10 0x0000000005386277 llvm::CoroEarlyPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5386277)
#11 0x0000000005238bae llvm::detail::PassModel<llvm::Module, llvm::CoroEarlyPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5238bae)
#12 0x000000000359c600 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x359c600)
#13 0x0000000005382b09 llvm::CoroConditionalWrapper::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5382b09)
#14 0x000000000523831e llvm::detail::PassModel<llvm::Module, llvm::CoroConditionalWrapper, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x523831e)
#15 0x000000000359c600 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x359c600)
#16 0x0000000003e95c2b (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#17 0x0000000003e99455 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e99455)
#18 0x000000000456376e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456376e)
#19 0x00000000066e4e7c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66e4e7c)
#20 0x0000000004563b58 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4563b58)
#21 0x000000000481e689 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x481e689)
#22 0x000000000479d8fe clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x479d8fe)
#23 0x000000000490441e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x490441e)
#24 0x0000000000ce624f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce624f)
#25 0x0000000000cddf0a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x00000000045a6cb9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#27 0x0000000003b35914 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b35914)
#28 0x00000000045a72af clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#29 0x000000000456d63d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456d63d)
#30 0x000000000456e72d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456e72d)
#31 0x0000000004575ae5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4575ae5)
#32 0x0000000000ce30e9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce30e9)
#33 0x0000000000bb0284 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbb0284)
#34 0x00007e5743429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x00007e5743429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x0000000000cdd9be _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcdd9be)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWktz2zgS_jX0BSUVCT5EHnyQKWsnU5mNy_LMHlUg2aIwAQEuADp2fv0WQEoiaDm2Z-19zG4qiS0IaHz99QMNsolStOYAl1585cWrC9LpvZCXj_R3wqM0ii8KUT1eenjp4eXdniqkQemSKEBUoRo4SKKhQsUjImjXff8Oct5P9vyV5w__56JpKQOJrh9aJiRIL1wiL77aa90qL1x6eO3hdS2qQjA9F7L28Pq7h9fVAq7VbldUXrzycPr66Tgbb29x3xNGK5R7-MrDV9hHpagAfaOMoVIStUeCo5wRXqOlUiA1FRzdyY5_nQ-SEr__W7ZtP0K5Rg2h3MOphzPkLa76cYS226KjTFO-LYUUW1p5OA2xh3Pkj__LvHBY4i1Wk13G8D9ppAAahfSeaKSNMrUAhQpSfkVaoNLAngXRfLxoo823Vde0hrBzwu2yng5rDryWQmgPrxm7b2atFL9DefhoftDCw-s7SbjaCdkoD69zIUWnKYfDh2si2ePcMBQusR8YsfeCVoYbwgV_bESnjK7h0guXn8U36F3BC5fMfLDLP3EtKVe0VB5O7d52wrrjpTGKhxPL3HJkJy_x13OqbiSollF9hHWwjFmSIA_juz2gnRRcA69Qp0ChzTeqy_3sFlTXQIWWV5-Q2ouOVQgaqs0a88-Lcw_jdpBfHuXbYUS0lrToNKCdkEjvAR1nzM1ivEA7QhlUg4FuPl8vN9dIdYXZgqCiq5GEVkhtrDlxcqr3XTEvRTOyhGsfqlRnLYAIrxDlJesq6GFYxzZuoiUpwbhdK6GVogSloEJKdLIfNiuJUqKkNpplx5EqJW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