Skip to content

[clang] [crash] crashed during compilation of a module file #159146

@mikomikotaishi

Description

@mikomikotaishi

A crash is occurring when trying to compile a program of mine, specifically the file Engine.cppm. Attached are the preprocessed source file (renamed to .cppm.txt from .cppm and run script). This started occurring today and it is not clear at what point inside my source file Engine.cppm is causing this.

Project is here, specific commit d4bfeca

This crash occurred with running make build, which internally runs

cmake -S . -B build -G Ninja
cmake --build build

Engine-88827d.cppm.txt
Engine-88827d.sh

Crash message and stack dump:

[25/32] Building CXX object src/openjuice/CMakeFiles/modules.dir/engine/game/Engine.cppm.o
FAILED: src/openjuice/CMakeFiles/modules.dir/engine/game/Engine.cppm.o src/openjuice/CMakeFiles/modules.dir/openjuice.engine.game.Engine.pcm 
/usr/bin/clang++ -DNDEBUG -DSFML_STATIC -DSTDLIB_EXTENSIONS -DSTDLIB_IMPLICIT_USING_CORE -DSTDLIB_USE_RESERVED_STD_IDENTIFIERS -I/home/utsuho/Projects/openJuice/include -I/home/utsuho/Projects/openJuice/build/_deps/boost-asio-src/include -I/home/utsuho/Projects/openJuice/build/_deps/boost-regex-src/include -I/home/utsuho/Projects/openJuice/build/_deps/boost-system-src/include -I/home/utsuho/Projects/openJuice/build/_deps/stdlib-src/include -I/home/utsuho/Projects/openJuice/build/_deps/stdlib-src/src/core/../../include -I/home/utsuho/Projects/openJuice/build/_deps/stdlib-src/src/alloc/../../include -I/home/utsuho/Projects/openJuice/build/_deps/stdlib-src/src/std/../../include -I/home/utsuho/Projects/openJuice/build/_deps/stdlib-src/src/stdx/../../include -I/home/utsuho/Projects/openJuice/deps/discordpp/discordpp -I/home/utsuho/Projects/openJuice/build/_deps/sfml-src/include -isystem /home/utsuho/Projects/openJuice/build/_deps/ftxui-src/include -O3 -DNDEBUG -std=c++23 -O3 -stdlib=libstdc++ --gcc-toolchain=/usr -Wall -Wextra -Wpedantic -Wshadow -Wunused-parameter -Wconversion -Wsign-conversion -MD -MT src/openjuice/CMakeFiles/modules.dir/engine/game/Engine.cppm.o -MF src/openjuice/CMakeFiles/modules.dir/engine/game/Engine.cppm.o.d @src/openjuice/CMakeFiles/modules.dir/engine/game/Engine.cppm.o.modmap -o src/openjuice/CMakeFiles/modules.dir/engine/game/Engine.cppm.o -c /home/utsuho/Projects/openJuice/src/openjuice/engine/game/Engine.cppm
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++ @/tmp/response-81fdbf.txt
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      /usr/lib64/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../include/c++/15.2.1/bits/std_thread.h:207:5: Generating code for declaration 'std::thread::joinable'
 #0 0x00007faeb0580ada llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.20.1+0x7780ada)
 #1 0x00007faeb047f592 (/usr/lib/libLLVM.so.20.1+0x767f592)
 #2 0x00007faea8644900 (/usr/lib/libc.so.6+0x44900)
 #3 0x00007faeb21e4785 clang::CodeGen::CodeGenFunction::EmitLValueForField(clang::CodeGen::LValue, clang::FieldDecl const*) (/usr/lib/libclang-cpp.so.20.1+0xfe4785)
 #4 0x00007faeb21e3ab2 clang::CodeGen::CodeGenFunction::EmitMemberExpr(clang::MemberExpr const*) (/usr/lib/libclang-cpp.so.20.1+0xfe3ab2)
 #5 0x00007faeb22726f5 clang::CodeGen::CodeGenFunction::EmitLValueHelper(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/usr/lib/libclang-cpp.so.20.1+0x10726f5)
 #6 0x00007faeb227346a clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*, clang::CodeGen::KnownNonNull_t) (/usr/lib/libclang-cpp.so.20.1+0x107346a)
 #7 0x00007faeb227b6a5 clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl const*, clang::CXXCtorType, bool, bool, clang::CodeGen::AggValueSlot, clang::CXXConstructExpr const*) (/usr/lib/libclang-cpp.so.20.1+0x107b6a5)
 #8 0x00007faeb2548fd7 clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(clang::CXXConstructExpr const*, clang::CodeGen::AggValueSlot) (/usr/lib/libclang-cpp.so.20.1+0x1348fd7)
 #9 0x00007faeb254875c (/usr/lib/libclang-cpp.so.20.1+0x134875c)
#10 0x00007faeb2548366 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/usr/lib/libclang-cpp.so.20.1+0x1348366)
#11 0x00007faeb22826bd clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/usr/lib/libclang-cpp.so.20.1+0x10826bd)
#12 0x00007faeb227da44 clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&, clang::Expr const*, clang::QualType) (/usr/lib/libclang-cpp.so.20.1+0x107da44)
#13 0x00007faeb227cdbb clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&, clang::CodeGen::CodeGenFunction::PrototypeWrapper, llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const* const, clang::Stmt const* const>>, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) (/usr/lib/libclang-cpp.so.20.1+0x107cdbb)
#14 0x00007faeb227befe clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*, llvm::CallBase**, clang::CodeGen::CGFunctionInfo const**) (/usr/lib/libclang-cpp.so.20.1+0x107befe)
#15 0x00007faeb23d3924 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/usr/lib/libclang-cpp.so.20.1+0x11d3924)
#16 0x00007faeb2282ab6 (/usr/lib/libclang-cpp.so.20.1+0x1082ab6)
#17 0x00007faeb36087eb (/usr/lib/libclang-cpp.so.20.1+0x24087eb)
#18 0x00007faeb2282790 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/libclang-cpp.so.20.1+0x1082790)
#19 0x00007faeb244857c clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) (/usr/lib/libclang-cpp.so.20.1+0x124857c)
#20 0x00007faeb360d42f (/usr/lib/libclang-cpp.so.20.1+0x240d42f)
#21 0x00007faeb2282790 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/libclang-cpp.so.20.1+0x1082790)
#22 0x00007faeb243d043 clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/usr/lib/libclang-cpp.so.20.1+0x123d043)
#23 0x00007faeb243e655 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/lib/libclang-cpp.so.20.1+0x123e655)
#24 0x00007faeb243e368 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/usr/lib/libclang-cpp.so.20.1+0x123e368)
#25 0x00007faeb243b9cd clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib/libclang-cpp.so.20.1+0x123b9cd)
#26 0x00007faeb220455a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.20.1+0x100455a)
#27 0x00007faeb211c0cd clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.20.1+0xf1c0cd)
#28 0x00007faeb2432899 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.20.1+0x1232899)
#29 0x00007faeb242b460 clang::CodeGen::CodeGenModule::Release() (/usr/lib/libclang-cpp.so.20.1+0x122b460)
#30 0x00007faeb242b3a0 (/usr/lib/libclang-cpp.so.20.1+0x122b3a0)
#31 0x00007faeb23e73c9 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.20.1+0x11e73c9)
#32 0x00007faeb219e143 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.20.1+0xf9e143)
#33 0x00007faeb25c957f clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.20.1+0x13c957f)
#34 0x00007faeb25c9134 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.20.1+0x13c9134)
#35 0x00007faeb25c8b9e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.20.1+0x13c8b9e)
#36 0x000055cf4018b981 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+++0x11981)
#37 0x000055cf4018adb4 (/usr/bin/clang+++0x10db4)
#38 0x000055cf40188ccd clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+++0xeccd)
#39 0x000055cf40188a8b main (/usr/bin/clang+++0xea8b)
#40 0x00007faea8627b8b (/usr/lib/libc.so.6+0x27b8b)
#41 0x00007faea8627c4b __libc_start_main (/usr/lib/libc.so.6+0x27c4b)
#42 0x000055cf4018d6a5 _start (/usr/bin/clang+++0x136a5)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 20.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/Engine-88827d.cppm
clang++: note: diagnostic msg: /tmp/Engine-88827d.sh
clang++: note: diagnostic msg: 

********************
ninja: build stopped: subcommand failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:codegenIR generation bugs: mangling, exceptions, etc.clang:modulesC++20 modules and Clang Header ModulescrashPrefer [crash-on-valid] or [crash-on-invalid]needs-reductionLarge reproducer that should be reduced into a simpler form

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions