<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117685>117685</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Assertion `SuspendType->isVoidPointerType()' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:codegen,
crash-on-invalid,
regression:19,
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/45vcnEsse](https://godbolt.org/z/45vcnEsse)
```cpp
namespace std {
template <class Promise = void>
struct coroutine_handle;
template <>
struct coroutine_handle<void> {
coroutine_handle() = default;
static coroutine_handle from_address(void *) noexcept;
void *address() const;
};
template <class Promise>
struct coroutine_handle : public coroutine_handle<> {
};
template <class... Args>
struct void_t_imp {
using type = void;
};
template <class... Args>
using void_t = typename void_t_imp<Args...>::type;
template <class T, class = void>
struct traits_sfinae_base {};
template <class T>
struct traits_sfinae_base<T, void_t<typename T::promise_type>> {
using promise_type = typename T::promise_type;
};
template <class Ret, class... Args>
struct coroutine_traits : public traits_sfinae_base<Ret> {};
} // namespace std
struct suspend_never {
bool await_ready() noexcept;
void await_suspend(std::coroutine_handle<>) noexcept;
void await_resume() noexcept;
};
struct task {
struct promise_type {
auto initial_suspend() { return suspend_never{}; }
auto final_suspend() noexcept { return suspend_never{}; }
auto get_return_object() { return task{}; }
static void unhandled_exception() {}
void return_void() {}
};
};
namespace std {
template <>
struct coroutine_handle<task::promise_type> : public coroutine_handle<> {
coroutine_handle<task::promise_type> *address() const; // expected-warning {{return type of 'coroutine_handle<>::address should be 'void*'}}
};
} // namespace std
struct awaitable {
bool await_ready();
std::coroutine_handle<task::promise_type>
await_suspend(std::coroutine_handle<> handle);
void await_resume();
} a;
task f() {
co_await a;
}
int main() {
f();
return 0U;
}
```
This goes back to clang-19.
Stack dump:
```
clang++: /root/llvm-project/clang/include/clang/AST/ExprCXX.h:5165: clang::CoroutineSuspendExpr::SuspendReturnType clang::CoroutineSuspendExpr::getSuspendReturnType() const: Assertion `SuspendType->isVoidPointerType()' 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-19.1.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-14.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O2 -std=c++20 <source>
1. <source>:70:1: current parser token 'int'
2. <source>:66:6: LLVM IR generation of declaration 'f'
3. <source>:66:6: Generating code for declaration 'f'
4. <source>:66:10: LLVM IR generation of compound statement ('{}')
#0 0x0000000003ae9978 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3ae9978)
#1 0x0000000003ae766c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3ae766c)
#2 0x0000000003a308f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007d55e2842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007d55e28969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007d55e2842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007d55e28287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007d55e282871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007d55e2839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000000000421e8e6 emitSuspendExpression(clang::CodeGen::CodeGenFunction&, clang::CodeGen::CGCoroData&, clang::CoroutineSuspendExpr const&, (anonymous namespace)::AwaitKind, clang::CodeGen::AggValueSlot, bool, bool) CGCoroutine.cpp:0:0
#10 0x000000000421e9d6 clang::CodeGen::CodeGenFunction::EmitCoawaitExpr(clang::CoawaitExpr const&, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x421e9d6)
#11 0x00000000042cb792 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#12 0x00000000042d8862 (anonymous namespace)::ScalarExprEmitter::VisitExprWithCleanups(clang::ExprWithCleanups*) CGExprScalar.cpp:0:0
#13 0x00000000042cba71 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#14 0x00000000042d10bc clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x42d10bc)
#15 0x000000000425b3fe clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x425b3fe)
#16 0x000000000427fc4d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x427fc4d)
#17 0x0000000003e4a095 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3e4a095)
#18 0x0000000003e51d14 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3e51d14)
#19 0x0000000003e521c9 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3e521c9)
#20 0x0000000003e5236e clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3e5236e)
#21 0x0000000003e4a025 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3e4a025)
#22 0x00000000042204a3 clang::CodeGen::CodeGenFunction::EmitCoroutineBody(clang::CoroutineBodyStmt const&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x42204a3)
#23 0x0000000003e4a2ea clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3e4a2ea)
#24 0x0000000003eb8b97 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3eb8b97)
#25 0x0000000003ecda4d clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3ecda4d)
#26 0x0000000003f2de52 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3f2de52)
#27 0x0000000003f28d55 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3f28d55)
#28 0x0000000003f292fb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3f292fb)
#29 0x0000000003f336b3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#30 0x00000000043fb906 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#31 0x00000000043ebe68 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x43ebe68)
#32 0x00000000064cc324 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x64cc324)
#33 0x00000000043f9448 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x43f9448)
#34 0x0000000004684f59 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x4684f59)
#35 0x0000000004609f8e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x4609f8e)
#36 0x000000000476e2be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x476e2be)
#37 0x0000000000c82b7f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xc82b7f)
#38 0x0000000000c7bcda ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x000000000443cba9 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
#40 0x0000000003a30da4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x3a30da4)
#41 0x000000000443d19f 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
#42 0x0000000004402c05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x4402c05)
#43 0x000000000440366d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x440366d)
#44 0x000000000440b075 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0x440b075)
#45 0x0000000000c7fe95 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xc7fe95)
#46 0x0000000000b547a4 main (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xb547a4)
#47 0x00007d55e2829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#48 0x00007d55e2829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#49 0x0000000000c7b78e _start (/opt/compiler-explorer/clang-assertions-19.1.0/bin/clang+++0xc7b78e)
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/eJzkW11z46i2_TXKC2WXhL4f8qA4Sd-e21PT1cntO28uJG05mpZBBSid9K8_BUiWkO0k7onnnJkz5enECDZrLfaGDSJEiHpDAS6d8MoJry9IJx8Yv3yu_yA0SILwImfl86WDMwdn9w-1QBKELIgAVAu0AQqcSChR_owIqrofP4AvTWXHVZ8V27Z1AxzdPLUN48AdP0NOePUgZSscP3PwrYNvN6zMWSOX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