clang 22 ICE `<eof> parser at end of file`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```
/usr/bin/ccache clang++ -Itests/test_helpers.p -Itests -I../tests -Iinclude -I../include -flto -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++20 -O2 -g -fPIE -MD -MQ tests/test_helpers.p/test_helpers.cpp.o -MF tests/test_helpers.p/test_helpers.cpp.o.d -o tests/test_helpers.p/test_helpers.cpp.o -c ../tests/test_helpers.cpp
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++ -Itests/test_helpers.p -Itests -I../tests -Iinclude -I../include -flto -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++20 -O2 -g -fPIE -MD -MQ tests/test_helpers.p/test_helpers.cpp.o -MF tests/test_helpers.p/test_helpers.cpp.o.d -fcolor-diagnostics -c -o tests/test_helpers.p/test_helpers.cpp.o ../tests/test_helpers.cpp
1. parser at end of file
2. Per-file LLVM IR generation
3. ../tests/test_helpers.cpp:240:6: Generating code for declaration '(anonymous namespace)::testFPBoth'
#0 0x00007fda12b6ad8b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.22.1+0x76ad8b)
#1 0x00007fda12b67987 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.22.1+0x767987)
#2 0x00007fda12a81367 (/lib64/libLLVM.so.22.1+0x681367)
#3 0x00007fda11c420e0 __restore_rt (/lib64/libc.so.6+0x420e0)
#4 0x00007fda1d2d52c4 (/lib64/libclang-cpp.so.22.1+0x1ed52c4)
#5 0x00007fda1d241f9d clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) (/lib64/libclang-cpp.so.22.1+0x1e41f9d)
#6 0x00007fda1d4b793f clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*, llvm::BasicBlock*, llvm::BasicBlock*, unsigned long, clang::Stmt::Likelihood, clang::Expr const*, clang::VarDecl const*) (/lib64/libclang-cpp.so.22.1+0x20b793f)
#7 0x00007fda1d2d9750 (/lib64/libclang-cpp.so.22.1+0x1ed9750)
#8 0x00007fda1d2b98f4 (/lib64/libclang-cpp.so.22.1+0x1eb98f4)
#9 0x00007fda1d2423d6 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/lib64/libclang-cpp.so.22.1+0x1e423d6)
#10 0x00007fda1d432843 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef) (/lib64/libclang-cpp.so.22.1+0x2032843)
#11 0x00007fda1d440b41 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/lib64/libclang-cpp.so.22.1+0x2040b41)
#12 0x00007fda1d4b4f3e clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/lib64/libclang-cpp.so.22.1+0x20b4f3e)
#13 0x00007fda1d4b614b clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/lib64/libclang-cpp.so.22.1+0x20b614b)
#14 0x00007fda1d4e020c clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/lib64/libclang-cpp.so.22.1+0x20e020c)
#15 0x00007fda1d4d7f1e clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/lib64/libclang-cpp.so.22.1+0x20d7f1e)
#16 0x00007fda1d4c88e2 clang::CodeGen::CodeGenModule::EmitDeferred() (/lib64/libclang-cpp.so.22.1+0x20c88e2)
#17 0x00007fda1d4c5013 clang::CodeGen::CodeGenModule::Release() (/lib64/libclang-cpp.so.22.1+0x20c5013)
#18 0x00007fda1d59e6b0 (/lib64/libclang-cpp.so.22.1+0x219e6b0)
#19 0x00007fda1d4a44d6 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.22.1+0x20a44d6)
#20 0x00007fda1bb07da9 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.22.1+0x707da9)
#21 0x00007fda1ddad44f clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.22.1+0x29ad44f)
#22 0x00007fda1dce6b2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.22.1+0x28e6b2e)
#23 0x00007fda1de4976f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.22.1+0x2a4976f)
#24 0x00005650cf6b2e57 cc1_main(llvm::ArrayRef, char const*, void*) (/usr/bin/clang+++0x11e57)
#25 0x00005650cf6af04d (/usr/bin/clang+++0xe04d)
#26 0x00005650cf6b097c (/usr/bin/clang+++0xf97c)
#27 0x00007fda1d94707d (/lib64/libclang-cpp.so.22.1+0x254707d)
#28 0x00007fda12a80fce llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/lib64/libLLVM.so.22.1+0x680fce)
#29 0x00007fda1d946d7b clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (/lib64/libclang-cpp.so.22.1+0x2546d7b)
#30 0x00007fda1d9012ba clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.22.1+0x25012ba)
#31 0x00007fda1d9014be clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/lib64/libclang-cpp.so.22.1+0x25014be)
#32 0x00007fda1d926a6c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/lib64/libclang-cpp.so.22.1+0x2526a6c)
#33 0x00005650cf6ae9c7 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+++0xd9c7)
#34 0x00005650cf6bc48c main (/usr/bin/clang+++0x1b48c)
#35 0x00007fda11c2b33e __libc_start_call_main /usr/src/debug/glibc-2.43/csu/../sysdeps/nptl/libc_start_call_main.h:83:3
#36 0x00007fda11c2b46b call_init /usr/src/debug/glibc-2.43/csu/../csu/libc-start.c:128:20
#37 0x00007fda11c2b46b __libc_start_main@GLIBC_2.2.5 /usr/src/debug/glibc-2.43/csu/../csu/libc-start.c:347:5
#38 0x00005650cf6acbf5 _start (/usr/bin/clang+++0xbbf5)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 22.1.7
Target: x86_64-suse-linux
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/test_helpers-fe0044.cpp
clang++: note: diagnostic msg: /tmp/test_helpers-fe0044.sh
clang++: note: diagnostic msg:
********************
```
[test_helpers-fe0044.cpp](https://github.com/user-attachments/files/30073998/test_helpers-fe0044.cpp)
[test_helpers-fe0044.sh](https://github.com/user-attachments/files/30073997/test_helpers-fe0044.sh)
Contributor guide
Research direction
Start by running the attached test_helpers-fe0044.sh with test_helpers-fe0044.cpp and confirm the clang 22.1.7 crash at tests/test_helpers.cpp:240 in testFPBoth. Trace the failure through the reported code-generation stack; done means the reproducer no longer causes clang to exit with 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
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100