llvm / llvm/llvm-project

clang frontend crash with exit code 139 when using modules with stdexec

Open
#223,489 3 comments 0 reactions 0 assignees View on GitHub
clang:modules crash
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

### system info:
- CachyOS
- clang 22.1.8
- gcc 16.2.1
- xmake v3.1.1

### clang version:
```
❯ clang -v
clang version 22.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/15.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/16
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.3.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /opt/cuda, version
Found HIP installation: /opt/rocm, version 3.5.0
```

### gcc version:
```
❯ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/CachyOS/CachyOS-PKGBUILDS/issues --with-build-config=bootstrap-lto --with-gcc-major-version-only --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-fixincludes --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.2.1 20260810 (GCC)
```

### crash logs :
```
❯ rm -rf .xmake .cache build
❯ xmake config --toolchain=clang
checking for platform ... linux (x86_64)
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
-> stdexec 2026.07.06 [license:Apache-2.0]
please input: y (y/n/m)

=> install stdexec 2026.07.06 .. ok
❯ xmake -v
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-O3) ... ok
checking for flags (-std=c++26) ... ok
checking for flags (-DNDEBUG) ... ok
[ 0%]: generating.module.deps src/implementation.cpp
checking for /usr/bin/clang-scan-deps ... ok
/usr/bin/clang-scan-deps --format=p1689 -- /usr/bin/clang++ -x c++ -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -c src/implementation.cpp -o build/.objs/test/linux/x86_64/release/src/implementation.cpp.o
[ 0%]: generating.module.deps src/interface.cpp
/usr/bin/clang-scan-deps --format=p1689 -- /usr/bin/clang++ -x c++ -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -c src/interface.cpp -o build/.objs/test/linux/x86_64/release/src/interface.cpp.o
[ 0%]: generating.module.deps src/main.cpp
/usr/bin/clang-scan-deps --format=p1689 -- /usr/bin/clang++ -x c++ -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -c src/main.cpp -o build/.objs/test/linux/x86_64/release/src/main.cpp.o
[ 0%]: generating.module.deps /usr/include/c++/16/bits/std.cc
/usr/bin/clang-scan-deps --format=p1689 -- /usr/bin/clang++ -x c++ -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -c /usr/include/c++/16/bits/std.cc -o build/.objs/test/linux/x86_64/release/usr/include/c++/16/bits/std.cc.o
[ 0%]: generating.module.deps /usr/include/c++/16/bits/std.compat.cc
/usr/bin/clang-scan-deps --format=p1689 -- /usr/bin/clang++ -x c++ -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -c /usr/include/c++/16/bits/std.compat.cc -o build/.objs/test/linux/x86_64/release/usr/include/c++/16/bits/std.compat.cc.o
checking for flags (clang_module_file) ... ok
checking for flags (clang_modules_reduced_bmi) ... ok
checking for flags (clang_module_output) ... ok
[ 8%]: compiling.module.bmi.release interface
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -x c++-module --precompile -o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/17fd3cadf5e23b17/interface.pcm src/interface.cpp
[ 8%]: compiling.module.bmi.release std
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -x c++-module --precompile -Wno-include-angled-in-module-purview -Wno-reserved-module-identifier -Wno-deprecated-declarations -o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/e9968aa214a321aa/std.pcm /usr/include/c++/16/bits/std.cc
[ 25%]: compiling.module.bmi.release implementation
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -fmodule-file=interface=build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/17fd3cadf5e23b17/interface.pcm -x c++-module --precompile -o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/371357a6c3f29794/implementation.pcm src/implementation.cpp
[ 34%]: compiling.release /usr/include/c++/16/bits/std.cc
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -Wno-include-angled-in-module-purview -Wno-reserved-module-identifier -Wno-deprecated-declarations -o build/.objs/test/linux/x86_64/release/usr/include/c++/16/bits/std.cc.o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/e9968aa214a321aa/std.pcm
[ 34%]: compiling.release src/implementation.cpp
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -fmodule-file=interface=build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/17fd3cadf5e23b17/interface.pcm -o build/.objs/test/linux/x86_64/release/src/implementation.cpp.o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/371357a6c3f29794/implementation.pcm
[ 43%]: compiling.release src/main.cpp
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -o build/.objs/test/linux/x86_64/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
[ 43%]: compiling.release src/interface.cpp
/usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -o build/.objs/test/linux/x86_64/release/src/interface.cpp.o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/17fd3cadf5e23b17/interface.pcm
create ok!
compile_commands.json updated!
error: 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: /usr/bin/clang++ -c -Qunused-arguments -m64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -O3 -std=c++26 -isystem /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include -DNDEBUG -fmodule-file=interface=build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/17fd3cadf5e23b17/interface.pcm -fdiagnostics-color=always -o build/.objs/test/linux/x86_64/release/src/implementation.cpp.o build/.gens/test/linux/x86_64/release/rules/bmi/cache/interfaces/371357a6c3f29794/implementation.pcm
1. parser at end of file
2. Per-file LLVM IR generation
3. /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include/exec/../stdexec/__detail/__task.hpp:420:26: Generating code for declaration 'stdexec::task::__awaiter_base::__awaiter_base'
4. /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include/exec/../stdexec/__detail/__task.hpp:427:7: LLVM IR generation of compound statement ('{}')
5. /mnt/RootVerse/foosfs/build/.packages/s/stdexec/2026.07.06/ab18b9ce4cd3416f9b75d5e82d3be6df/include/exec/../stdexec/__detail/__task.hpp:440:9: LLVM IR generation of compound statement ('{}')
#0 0x00007fb2d7d9143a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.22.1+0x839143a)
#1 0x00007fb2d7d911cb llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM.so.22.1+0x83911cb)
#2 0x00007fb2d7d46b40 (/usr/lib/libLLVM.so.22.1+0x8346b40)
#3 0x00007fb2d7d46d5d (/usr/lib/libLLVM.so.22.1+0x8346d5d)
#4 0x00007fb2cf244e70 (/usr/lib/libc.so.6+0x44e70)
#5 0x00007fb2d639acc4 llvm::Type::isIntegerTy(unsigned int) const (/usr/lib/libLLVM.so.22.1+0x699acc4)
#6 0x00007fb2d996ea3d clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) (/usr/lib/libclang-cpp.so.22.1+0xf6ea3d)
#7 0x00007fb2da2b97f0 (/usr/lib/libclang-cpp.so.22.1+0x18b97f0)
#8 0x00007fb2da2b9406 clang::CodeGen::CodeGenFunction::EmitCallExprLValue(clang::CallExpr const*, llvm::CallBase**) (/usr/lib/libclang-cpp.so.22.1+0x18b9406)
#9 0x00007fb2d9c2d799 (/usr/lib/libclang-cpp.so.22.1+0x122d799)
#10 0x00007fb2d9c2d3d4 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/usr/lib/libclang-cpp.so.22.1+0x122d3d4)
#11 0x00007fb2d9c2d9fc (/usr/lib/libclang-cpp.so.22.1+0x122d9fc)
#12 0x00007fb2d9dd88e7 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef) (/usr/lib/libclang-cpp.so.22.1+0x13d88e7)
#13 0x00007fb2d9dd875d clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef) (/usr/lib/libclang-cpp.so.22.1+0x13d875d)
#14 0x00007fb2d9dcaec0 clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) (/usr/lib/libclang-cpp.so.22.1+0x13caec0)
#15 0x00007fb2d9dd87d4 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef) (/usr/lib/libclang-cpp.so.22.1+0x13d87d4)
#16 0x00007fb2d9dd875d clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef) (/usr/lib/libclang-cpp.so.22.1+0x13d875d)
#17 0x00007fb2da048a6b clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&) (/usr/lib/libclang-cpp.so.22.1+0x1648a6b)
#18 0x00007fb2d9dd65e8 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib/libclang-cpp.so.22.1+0x13d65e8)
#19 0x00007fb2da29c182 clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) (/usr/lib/libclang-cpp.so.22.1+0x189c182)
#20 0x00007fb2da29bc48 (/usr/lib/libclang-cpp.so.22.1+0x189bc48)
#21 0x00007fb2da2acfb8 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.22.1+0x18acfb8)
#22 0x00007fb2d9adc26f clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc26f)
#23 0x00007fb2d9adc2b9 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc2b9)
#24 0x00007fb2d9adc2b9 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc2b9)
#25 0x00007fb2d9adc2b9 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc2b9)
#26 0x00007fb2d9adc2b9 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc2b9)
#27 0x00007fb2d9adc2b9 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc2b9)
#28 0x00007fb2d9adc2b9 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x10dc2b9)
#29 0x00007fb2d9adc540 clang::CodeGen::CodeGenModule::Release() (/usr/lib/libclang-cpp.so.22.1+0x10dc540)
#30 0x00007fb2d9adc480 (/usr/lib/libclang-cpp.so.22.1+0x10dc480)
#31 0x00007fb2da0bf3c1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.22.1+0x16bf3c1)
#32 0x00007fb2d9ba51c8 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.22.1+0x11a51c8)
#33 0x00007fb2d9e87dfe clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.22.1+0x1487dfe)
#34 0x00007fb2d9e8758a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.22.1+0x148758a)
#35 0x000055c7df10a280 cc1_main(llvm::ArrayRef, char const*, void*) (/usr/bin/clang+++0x11280)
#36 0x000055c7df109679 (/usr/bin/clang+++0x10679)
#37 0x000055c7df109556 (/usr/bin/clang+++0x10556)
#38 0x00007fb2db56721d (/usr/lib/libclang-cpp.so.22.1+0x2b6721d)
#39 0x00007fb2d7d46ada llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/usr/lib/libLLVM.so.22.1+0x8346ada)
#40 0x00007fb2da185bb2 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (/usr/lib/libclang-cpp.so.22.1+0x1785bb2)
#41 0x00007fb2da06e4ff clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.22.1+0x166e4ff)
#42 0x00007fb2da06de92 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/usr/lib/libclang-cpp.so.22.1+0x166de92)
#43 0x000055c7df1080f9 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+++0xf0f9)
#44 0x000055c7df10754b main (/usr/bin/clang+++0xe54b)
#45 0x00007fb2cf227d0e (/usr/lib/libc.so.6+0x27d0e)
#46 0x00007fb2cf227e4b __libc_start_main (/usr/lib/libc.so.6+0x27e4b)
#47 0x000055c7df10d1d5 _start (/usr/bin/clang+++0x141d5)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 22.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
```

### minimal reproducible example :
`clang++: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.` -- so i coudnt get any preprocessed source to attach.

interface.cpp :
```cpp
module;

#include

export module interface;

export struct interface_t
{
virtual auto foo() -> stdexec::task
{
co_return false;
}

virtual ~interface_t() = default;
};
```

implementation.cpp :
```cpp
module;

#include

export module implementation;

import interface;

auto bar() -> stdexec::task
{
co_return true;
}

export struct implementation_t : public interface_t
{
auto foo() -> stdexec::task override
{
bool result = co_await bar();
co_return result;
}
};
```

This code crashes both clang and gcc compilers. The issue seems to happen only when using modules with stdexec, normal header based code compiles fine.

**Download minimal xmake project:** [clang_crasher.zip](https://github.com/user-attachments/files/32205121/clang_crasher.zip)

**For clean compiling:**
- cd to extracted code folder
- `rm -rf .xmake .cache build`
- `xmake config --toolchain=clang -v` (or `--toolchain=gcc` for testing gcc)
- `xmake -v` to build

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported clang++ command using the generated interface.pcm and implementation.pcm files, then inspect the crash path in stdexec/__detail/__task.hpp around lines 420-440. The stack points to LLVM IR generation and CodeGenTypes::ConvertTypeForMem; done means the same modules build no longer cause clang to crash with exit code 139.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.