Skip to content

clang 21.1.6: crash in LazyCallGraph::visitReferences (using modules) #170099

@adityasz

Description

@adityasz
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-21 -cc1 -triple x86_64-redhat-linux-gnu -O3 -emit-llvm-bc -flto=full -flto-unit -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Utils.ixx -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -menable-no-infs -menable-no-nans -fapprox-func -funsafe-math-optimizations -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -mfpmath sse -complex-range=basic -mconstructor-aliases -funwind-tables=2 -target-cpu alderlake -target-feature +prfchw -target-feature -cldemote -target-feature +avx -target-feature +aes -target-feature +sahf -target-feature +pclmul -target-feature -xop -target-feature +crc32 -target-feature -amx-fp8 -target-feature +xsaves -target-feature -avx512fp16 -target-feature -usermsr -target-feature -sm4 -target-feature -egpr -target-feature +sse4.1 -target-feature -avx512ifma -target-feature +xsave -target-feature +sse4.2 -target-feature -tsxldtrk -target-feature -sm3 -target-feature +ptwrite -target-feature +widekl -target-feature -movrs -target-feature +invpcid -target-feature +64bit -target-feature +xsavec -target-feature -avx10.1-512 -target-feature -avx512vpopcntdq -target-feature +cmov -target-feature -avx512vp2intersect -target-feature -avx512cd -target-feature +movbe -target-feature -avxvnniint8 -target-feature -ccmp -target-feature -amx-int8 -target-feature +kl -target-feature -avx10.1-256 -target-feature -sha512 -target-feature +avxvnni -target-feature -rtm -target-feature +adx -target-feature +avx2 -target-feature +hreset -target-feature +movdiri -target-feature +serialize -target-feature +vpclmulqdq -target-feature -avx512vl -target-feature -uintr -target-feature -cf -target-feature +clflushopt -target-feature -raoint -target-feature -cmpccxadd -target-feature +bmi -target-feature -amx-tile -target-feature -avx10.2-256 -target-feature +gfni -target-feature -avxvnniint16 -target-feature -amx-fp16 -target-feature -zu -target-feature -ndd -target-feature +xsaveopt -target-feature +rdrnd -target-feature -avx512f -target-feature -amx-bf16 -target-feature -avx512bf16 -target-feature -avx512vnni -target-feature -push2pop2 -target-feature +cx8 -target-feature -avx512bw -target-feature +sse3 -target-feature +pku -target-feature -nf -target-feature -amx-tf32 -target-feature -amx-avx512 -target-feature +fsgsbase -target-feature -clzero -target-feature -mwaitx -target-feature -lwp -target-feature +lzcnt -target-feature +sha -target-feature +movdir64b -target-feature -ppx -target-feature -wbnoinvd -target-feature -enqcmd -target-feature -amx-transpose -target-feature -avx10.2-512 -target-feature -avxneconvert -target-feature -tbm -target-feature -pconfig -target-feature -amx-complex -target-feature +ssse3 -target-feature +cx16 -target-feature +bmi2 -target-feature +fma -target-feature +popcnt -target-feature -avxifma -target-feature +f16c -target-feature -avx512bitalg -target-feature -rdpru -target-feature +clwb -target-feature +mmx -target-feature +rdseed -target-feature -avx512vbmi2 -target-feature -prefetchi -target-feature -amx-movrs -target-feature +rdpid -target-feature -fma4 -target-feature -avx512vbmi -target-feature +shstk -target-feature +vaes -target-feature +waitpkg -target-feature -sgx -target-feature +fxsr -target-feature -avx512dq -target-feature -sse4a -target-feature +sse -target-feature +sse2 -debugger-tuning=gdb -fdebug-compilation-dir=/home/aditya/Projects/hyprland/wm/build/release -fcoverage-compilation-dir=/home/aditya/Projects/hyprland/wm/build/release -resource-dir /usr/bin/../lib/clang/21 -Wall -Wpedantic -Wextra -std=gnu++26 -fdeprecated-macro -ferror-limit 19 -pthread -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o lib/Support/CMakeFiles/Support.dir/__/__/modules/Support/Utils.ixx.o -x pcm lib/Support/CMakeFiles/Support.dir/wm.Support.Utils.pcm
1.	<eof> parser at end of file
2.	Optimizer
3.	Running pass "rpo-function-attrs" on module "lib/Support/CMakeFiles/Support.dir/wm.Support.Utils.pcm"
 #0 0x00007f198facc869 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.21.1+0x50cc869)
 #1 0x00007f198facd2ad (/lib64/libLLVM.so.21.1+0x50cd2ad)
 #2 0x00007f198a4262c0 __restore_rt (/lib64/libc.so.6+0x1a2c0)
 #3 0x00007f198edb6012 llvm::LazyCallGraph::visitReferences(llvm::SmallVectorImpl<llvm::Constant*>&, llvm::SmallPtrSetImpl<llvm::Constant*>&, llvm::function_ref<void (llvm::Function&)>) (/lib64/libLLVM.so.21.1+0x43b6012)
 #4 0x00007f198edb52a4 llvm::LazyCallGraph::LazyCallGraph(llvm::Module&, llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>) (/lib64/libLLVM.so.21.1+0x43b52a4)
 #5 0x00007f198f77e6a5 (/lib64/libLLVM.so.21.1+0x4d7e6a5)
 #6 0x00007f198f77cf01 llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*, llvm::Module&) (/lib64/libLLVM.so.21.1+0x4d7cf01)
 #7 0x00007f198f77d78a llvm::ReversePostOrderFunctionAttrsPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM.so.21.1+0x4d7d78a)
 #8 0x00007f198f77d741 (/lib64/libLLVM.so.21.1+0x4d7d741)
 #9 0x00007f198eb808e7 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM.so.21.1+0x41808e7)
#10 0x00007f199525b1fd (/lib64/libclang-cpp.so.21.1+0x1e5b1fd)
#11 0x00007f19952565fa 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*) (/lib64/libclang-cpp.so.21.1+0x1e565fa)
#12 0x00007f19952545a6 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.21.1+0x1e545a6)
#13 0x00007f199490c712 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.21.1+0x150c712)
#14 0x00007f19951c8fff clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.21.1+0x1dc8fff)
#15 0x00007f19951c8b10 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.21.1+0x1dc8b10)
#16 0x00007f19951c84b5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.21.1+0x1dc84b5)
#17 0x000055f02f7268d6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-21+0x198d6)
#18 0x000055f02f71da4e (/usr/bin/clang-21+0x10a4e)
#19 0x000055f02f71f534 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-21+0x12534)
#20 0x000055f02f71e782 main (/usr/bin/clang-21+0x11782)
#21 0x00007f198a40f5b5 __libc_start_call_main (/lib64/libc.so.6+0x35b5)
#22 0x00007f198a40f668 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3668)
#23 0x000055f02f728f85 _start (/usr/bin/clang-21+0x1bf85)
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 21.1.6 (Fedora 21.1.6-1.fc43)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang++.cfg
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/Utils-61a62a.cppm
clang++: note: diagnostic msg: /tmp/Utils-61a62a.sh
clang++: note: diagnostic msg: 

********************

Utils-61a62a.cppm was renamed because GitHub was not uploading it with the .cppm extension.

Utils-61a62a.cpp
Utils-61a62a.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    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