Issue |
149111
|
Summary |
[clang][x86-64] Assertion failure in InitListExpr::getInit (“Initializer access out of range!”)
|
Labels |
clang
|
Assignees |
|
Reporter |
BKUS21
|
Compiler Explorer: https://godbolt.org/z/qrsYGreMr
Generated by fuzzer.
Console output:
```
<source>:1:5: error: expected identifier or '('
1 | int {
| ^
<source>:5:3: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
5 | } yv7 = {
| ^
| int
<source>:6:5: warning: too many braces around scalar initializer [-Wmany-braces-around-scalar-init]
6 | {},
| ^~
clang-22: /root/llvm-project/llvm/tools/clang/include/clang/AST/Expr.h:5287: clang::Expr* clang::InitListExpr::getInit(unsigned int): Assertion `Init < getNumInits() && "Initializer access out of range!"' failed.
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: /opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22 -cc1 -triple x86_64-unknown-linux-gnu -O2 -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20250716/lib/clang/22 -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20250716/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-80ad5a.o -x c <source>
1. <source>:8:2: current parser token ';'
#0 0x0000000003fb2168 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x3fb2168)
#1 0x0000000003faf014 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000075dd03e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000075dd03e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000075dd03e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000075dd03e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000075dd03e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000075dd03e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000006cdb5b7 clang::InitListExpr::getInit(unsigned int) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x6cdb5b7)
#9 0x0000000006cef0b5 (anonymous namespace)::InitListChecker::CheckExplicitInitList(clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, clang::InitListExpr*, bool) (.constprop.0) SemaInit.cpp:0:0
#10 0x0000000006cef377 (anonymous namespace)::InitListChecker::InitListChecker(clang::Sema&, clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, bool, bool, bool, llvm::SmallVectorImpl<clang::QualType>*) SemaInit.cpp:0:0
#11 0x0000000006cf8e7b clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x6cf8e7b)
#12 0x0000000006a2f4d5 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x6a2f4d5)
#13 0x00000000066953da clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x66953da)
#14 0x00000000066a3c39 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x66a3c39)
#15 0x000000000666167e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x666167e)
#16 0x0000000006661e19 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x6661e19)
#17 0x0000000006669aaa clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x6669aaa)
#18 0x000000000666aa45 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x666aa45)
#19 0x000000000665c81a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x665c81a)
#20 0x0000000004967388 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4967388)
#21 0x0000000004c5ad75 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4c5ad75)
#22 0x0000000004bd782e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4bd782e)
#23 0x0000000004d4e821 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0x4d4e821)
#24 0x0000000000d933bf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xd933bf)
#25 0x0000000000d89f9a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x0000000000d8e6b9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xd8e6b9)
#27 0x0000000000c44414 main (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xc44414)
#28 0x000075dd03e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#29 0x000075dd03e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#30 0x0000000000d89a45 _start (/opt/compiler-explorer/clang-assertions-trunk-20250716/bin/clang-22+0xd89a45)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 254
```
Code:
```c
int {
float lv7[0];
char mv7 : 6;
char mv7_1;
} yv7 = {
{},
52,
};
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs