Issue |
134054
|
Summary |
CoroEarlyPass asserts when using thinlto pipeline: CoroInstr.h:220: void llvm::CoroIdInst::setCoroutineSelf(): Assertion `isa<ConstantPointerNull>(getArgOperand(CoroutineArg)) && "Coroutine argument is already assigned"' failed.
|
Labels |
LTO,
coroutines
|
Assignees |
|
Reporter |
zmodem
|
Consider:
```
$ cat /tmp/a.cc
#include <coroutine>
struct BasicCoroutine { // From https://theshoemaker.de/posts/yet-another-cpp-coroutine-tutorial
struct Promise {
BasicCoroutine get_return_object() { return BasicCoroutine {}; }
void unhandled_exception() noexcept { }
void return_void() noexcept { }
std::suspend_never initial_suspend() noexcept { return {}; }
std::suspend_never final_suspend() noexcept { return {}; }
};
using promise_type = Promise;
};
BasicCoroutine coro() {
co_return;
}
$ build/bin/clang -std=c++20 -O2 -flto=thin -c /tmp/a.cc -o /tmp/a.o.bc
$ build/bin/clang -c -x ir /tmp/a.o.bc
clang: /work/llvm-project/llvm/include/llvm/Transforms/Coroutines/CoroInstr.h:220: void llvm::CoroIdInst::setCoroutineSelf(): Assertion `isa<ConstantPointerNull>(getArgOperand(CoroutineArg)) && "Coroutine argument is already assigned"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: build/bin/clang -c -x ir /tmp/a.o.bc
1. Optimizer
2. Running pass "coro-cond(coro-early,cgscc(coro-split),coro-cleanup,globaldce)" on module "/tmp/a.o.bc"
3. Running pass "coro-early" on module "/tmp/a.o.bc"
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 clang 0x0000562f3ad7bf2b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1 clang 0x0000562f3ad794b4 llvm::sys::CleanupOnSignal(unsigned long) + 132
2 clang 0x0000562f3acae1e0
3 libc.so.6 0x00007f695f163e20
4 libc.so.6 0x00007f695f1b7e5c
5 libc.so.6 0x00007f695f163d82 gsignal + 18
6 libc.so.6 0x00007f695f14c4f0 abort + 211
7 libc.so.6 0x00007f695f14c418
8 libc.so.6 0x00007f695f15c692
9 clang 0x0000562f3c515200
10 clang 0x0000562f3c515776 llvm::CoroEarlyPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 806
11 clang 0x0000562f3c3e6d3d
12 clang 0x0000562f3a6a9d5c llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 1436
13 clang 0x0000562f3c512141 llvm::CoroConditionalWrapper::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 161
14 clang 0x0000562f3c3e645d
15 clang 0x0000562f3a6a9d5c llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 1436
16 clang 0x0000562f3b047a5e
17 clang 0x0000562f3b04b76c
18 clang 0x0000562f3b04c327 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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*) + 423
19 clang 0x0000562f3b740e0f clang::CodeGenAction::ExecuteAction() + 3535
20 clang 0x0000562f3ba79cd3 clang::FrontendAction::Execute() + 35
21 clang 0x0000562f3b9f921e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1966
22 clang 0x0000562f3bb626a7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 439
23 clang 0x0000562f3794b82f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 11007
24 clang 0x0000562f37941b80
25 clang 0x0000562f3b7ae589
26 clang 0x0000562f3acae632 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 146
27 clang 0x0000562f3b7b096e
28 clang 0x0000562f3b76abbb clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 155
29 clang 0x0000562f3b76bc2f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 143
30 clang 0x0000562f3b778854 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 356
31 clang 0x0000562f379470a2 clang_main(int, char**, llvm::ToolContext const&) + 9314
32 clang 0x0000562f377ea203 main + 83
33 libc.so.6 0x00007f695f14dd68
34 libc.so.6 0x00007f695f14de25 __libc_start_main + 133
35 clang 0x0000562f379411a1 _start + 33
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 21.0.0git (https://github.com/llvm/llvm-project.git 9e5bfbf77db0945f59c0d18012a8e6d43c711b3a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/llvm-project/build/bin
Build config: +assertions
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs