Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using enum declaration with anonymous enum crashes clang frontend #86790

Closed
svetli97 opened this issue Mar 27, 2024 · 2 comments · Fixed by #87144
Closed

using enum declaration with anonymous enum crashes clang frontend #86790

svetli97 opened this issue Mar 27, 2024 · 2 comments · Fixed by #87144
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@svetli97
Copy link

Minimal example:

enum {A, S, D, F}; // the enum is in an outer scope to avoid name collisions. This seems unrelated to the bug.
// enum Asdf {A, S, D, F}; // naming the enum prevents the crash
int main()
{
    using asdf = decltype(A);
    using enum asdf; // this line causes the crash
    return 0;
}

Needs additional clang command line argument "-std=c++20" (or later) to support using-enum-declarations.
The gcc compiler compiles this code without any problems.
Downloaded compilers from https://winlibs.com/
exact file download link: https://github.com/brechtsanders/winlibs_mingw/releases/download/13.1.0-16.0.5-11.0.0-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.1.0-llvm-16.0.5-mingw-w64ucrt-11.0.0-r5.zip
OS: Windows

Expected behavior: the code should compile.

Observed behavior: clang frontend crashes with the following error message:

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: C:/Users/svetlin.totev/libs/mingw64/bin/clang.exe -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=C:/Users/svetlin.totev/Documents/test -resource-dir C:/Users/svetlin.totev/libs/mingw64/lib/clang/16 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++ -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++ -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/clang/16/include -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/usr/include -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=C:/Users/svetlin.totev/Documents/test -ferror-limit 19 -fmessage-length=208 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -exception-model=seh -fcolor-diagnostics -faddrsig -o C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-6235c7.o -x c++ test.cpp
1.      test.cpp:6:20: current parser token ';'
2.      test.cpp:4:1: parsing function body 'main'
3.      test.cpp:4:1: in compound statement ('{}')
Exception Code: 0xC0000005
 #0 0x00007ffc8f81c940 clang::DeclarationName::getFETokenInfo() const (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x55c940)
 #1 0x00007ffc8f5921ae clang::IdentifierResolver::begin(clang::DeclarationName) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x2d21ae)
 #2 0x00007ffc8f68d0e4 clang::Sema::PushOnScopeChains(clang::NamedDecl*, clang::Scope*, bool) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x3cd0e4)
 #3 0x00007ffc8f739dd8 clang::Sema::ActOnUsingEnumDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&, clang::CXXScopeSpec*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x479dd8)
 #4 0x00007ffce334d0af clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x3d0af)
 #5 0x00007ffce338040d clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x7040d)
 #6 0x00007ffce332ce33 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x1ce33)
 #7 0x00007ffce338ea4e clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x7ea4e)
 #8 0x00007ffce3370d8c clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x60d8c)
 #9 0x00007ffce3362e8e clang::Parser::ParseCompoundStatementBody(bool) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x52e8e)
#10 0x00007ffce3366709 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x56709)
#11 0x00007ffce3354dd9 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x44dd9)
#12 0x00007ffce3328f35 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x18f35)
#13 0x00007ffce3378243 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x68243)
#14 0x00007ffce33861a2 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x761a2)
#15 0x00007ffce3359d76 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x49d76) 
#16 0x00007ffce3332963 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x22963)
#17 0x00007ffce33934b0 clang::ParseAST(clang::Sema&, bool, bool) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x834b0)
#18 0x00007ffce46caa52 clang::FrontendAction::Execute() (C:\Users\svetlin.totev\libs\mingw64\bin\libclangFrontend.dll+0x4aa52)
#19 0x00007ffce46d051c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangFrontend.dll+0x5051c)
#20 0x00007ffd25b739dd clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangFrontendTool.dll+0x39dd)
#21 0x00007ff74529ac56 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0xac56)
#22 0x00007ff74529b385 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0xb385)
#23 0x00007ff745296db6 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0x6db6)
#24 0x00007ff7452912ee (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0x12ee)
#25 0x00007ff745291406 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0x1406)
#26 0x00007ffd2d1d257d (C:\Windows\System32\KERNEL32.DLL+0x1257d)
#27 0x00007ffd2dbeaa58 (C:\Windows\SYSTEM32\ntdll.dll+0x5aa58)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
(built by Brecht Sanders) clang version 16.0.5
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/Users/svetlin.totev/libs/mingw64/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: C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.cpp
clang: note: diagnostic msg: C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.sh
clang: note: diagnostic msg:

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

The files mentioned in the error message:
C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.cpp:

# 1 "test.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 459 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.cpp" 2
enum {A, S, D, F};

int main()
{
    using asdf = decltype(A);
    using enum asdf;
    return 0;
}

C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.sh:

# Crash reproducer for (built by Brecht Sanders) clang version 16.0.5
# Driver args: "test.cpp" "-o" "text.exe" "-std=c++20"
# Original command:  "C:/Users/svetlin.totev/libs/mingw64/bin/clang.exe" "-cc1" "-triple" "x86_64-w64-windows-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-resource-dir" "C:/Users/svetlin.totev/libs/mingw64/lib/clang/16" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/clang/16/include" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/usr/include" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include" "-std=c++20" "-fdeprecated-macro" "-fdebug-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-ferror-limit" "19" "-fmessage-length=208" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-faddrsig" "-o" "C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-6235c7.o" "-x" "c++" "test.cpp"
 "C:/Users/svetlin.totev/libs/mingw64/bin/clang.exe" "-cc1" "-triple" "x86_64-w64-windows-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-std=c++20" "-fdeprecated-macro" "-fdebug-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-ferror-limit" "19" "-fmessage-length=208" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-faddrsig" "-x" "c++" "test-0047ff.cpp"

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Mar 27, 2024
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Mar 27, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 27, 2024

@llvm/issue-subscribers-clang-frontend

Author: None (svetli97)

Minimal example: ``` enum {A, S, D, F}; // the enum is in an outer scope to avoid name collisions. This seems unrelated to the bug. // enum Asdf {A, S, D, F}; // naming the enum prevents the crash int main() { using asdf = decltype(A); using enum asdf; // this line causes the crash return 0; } ``` Needs additional clang command line argument "-std=c++20" (or later) to support using-enum-declarations. The gcc compiler compiles this code without any problems. Downloaded compilers from https://winlibs.com/ exact file download link: https://github.com/brechtsanders/winlibs_mingw/releases/download/13.1.0-16.0.5-11.0.0-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.1.0-llvm-16.0.5-mingw-w64ucrt-11.0.0-r5.zip OS: Windows

Expected behavior: the code should compile.

Observed behavior: clang frontend crashes with the following error message:

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: C:/Users/svetlin.totev/libs/mingw64/bin/clang.exe -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=C:/Users/svetlin.totev/Documents/test -resource-dir C:/Users/svetlin.totev/libs/mingw64/lib/clang/16 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++ -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++ -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/x86_64-w64-mingw32 -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/backward -internal-isystem C:/Users/svetlin.totev/libs/mingw64/lib/clang/16/include -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include -internal-isystem C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/usr/include -internal-isystem C:/Users/svetlin.totev/libs/mingw64/include -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=C:/Users/svetlin.totev/Documents/test -ferror-limit 19 -fmessage-length=208 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -exception-model=seh -fcolor-diagnostics -faddrsig -o C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-6235c7.o -x c++ test.cpp
1.      test.cpp:6:20: current parser token ';'
2.      test.cpp:4:1: parsing function body 'main'
3.      test.cpp:4:1: in compound statement ('{}')
Exception Code: 0xC0000005
 #<!-- -->0 0x00007ffc8f81c940 clang::DeclarationName::getFETokenInfo() const (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x55c940)
 #<!-- -->1 0x00007ffc8f5921ae clang::IdentifierResolver::begin(clang::DeclarationName) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x2d21ae)
 #<!-- -->2 0x00007ffc8f68d0e4 clang::Sema::PushOnScopeChains(clang::NamedDecl*, clang::Scope*, bool) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x3cd0e4)
 #<!-- -->3 0x00007ffc8f739dd8 clang::Sema::ActOnUsingEnumDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&amp;, clang::CXXScopeSpec*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangSema.dll+0x479dd8)
 #<!-- -->4 0x00007ffce334d0af clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&amp;, clang::SourceLocation, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::AccessSpecifier) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x3d0af)
 #<!-- -->5 0x00007ffce338040d clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&amp;, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x7040d)
 #<!-- -->6 0x00007ffce332ce33 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::SourceLocation*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x1ce33)
 #<!-- -->7 0x00007ffce338ea4e clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x7ea4e)
 #<!-- -->8 0x00007ffce3370d8c clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x60d8c)
 #<!-- -->9 0x00007ffce3362e8e clang::Parser::ParseCompoundStatementBody(bool) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x52e8e)
#<!-- -->10 0x00007ffce3366709 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x56709)
#<!-- -->11 0x00007ffce3354dd9 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::Parser::LateParsedAttrList*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x44dd9)
#<!-- -->12 0x00007ffce3328f35 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&amp;, clang::DeclaratorContext, clang::ParsedAttributes&amp;, clang::SourceLocation*, clang::Parser::ForRangeInit*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x18f35)
#<!-- -->13 0x00007ffce3378243 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x68243)
#<!-- -->14 0x00007ffce33861a2 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x761a2)
#<!-- -->15 0x00007ffce3359d76 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x49d76) 
#<!-- -->16 0x00007ffce3332963 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x22963)
#<!-- -->17 0x00007ffce33934b0 clang::ParseAST(clang::Sema&amp;, bool, bool) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangParse.dll+0x834b0)
#<!-- -->18 0x00007ffce46caa52 clang::FrontendAction::Execute() (C:\Users\svetlin.totev\libs\mingw64\bin\libclangFrontend.dll+0x4aa52)
#<!-- -->19 0x00007ffce46d051c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangFrontend.dll+0x5051c)
#<!-- -->20 0x00007ffd25b739dd clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (C:\Users\svetlin.totev\libs\mingw64\bin\libclangFrontendTool.dll+0x39dd)
#<!-- -->21 0x00007ff74529ac56 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0xac56)
#<!-- -->22 0x00007ff74529b385 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0xb385)
#<!-- -->23 0x00007ff745296db6 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0x6db6)
#<!-- -->24 0x00007ff7452912ee (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0x12ee)
#<!-- -->25 0x00007ff745291406 (C:\Users\svetlin.totev\libs\mingw64\bin\clang.exe+0x1406)
#<!-- -->26 0x00007ffd2d1d257d (C:\Windows\System32\KERNEL32.DLL+0x1257d)
#<!-- -->27 0x00007ffd2dbeaa58 (C:\Windows\SYSTEM32\ntdll.dll+0x5aa58)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
(built by Brecht Sanders) clang version 16.0.5
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/Users/svetlin.totev/libs/mingw64/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: C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.cpp
clang: note: diagnostic msg: C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.sh
clang: note: diagnostic msg:

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

The files mentioned in the error message:
C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.cpp:

# 1 "test.cpp"
# 1 "&lt;built-in&gt;" 1
# 1 "&lt;built-in&gt;" 3
# 459 "&lt;built-in&gt;" 3
# 1 "&lt;command line&gt;" 1
# 1 "&lt;built-in&gt;" 2
# 1 "test.cpp" 2
enum {A, S, D, F};

int main()
{
    using asdf = decltype(A);
    using enum asdf;
    return 0;
}

C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-0047ff.sh:

# Crash reproducer for (built by Brecht Sanders) clang version 16.0.5
# Driver args: "test.cpp" "-o" "text.exe" "-std=c++20"
# Original command:  "C:/Users/svetlin.totev/libs/mingw64/bin/clang.exe" "-cc1" "-triple" "x86_64-w64-windows-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-resource-dir" "C:/Users/svetlin.totev/libs/mingw64/lib/clang/16" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include/c++/13.1.0/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include/c++/13.1.0/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1.0/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13.1/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/x86_64-w64-mingw32" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/gcc/x86_64-w64-mingw32/13.1.0/include/g++-v13/backward" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/lib/clang/16/include" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/include" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/x86_64-w64-mingw32/usr/include" "-internal-isystem" "C:/Users/svetlin.totev/libs/mingw64/include" "-std=c++20" "-fdeprecated-macro" "-fdebug-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-ferror-limit" "19" "-fmessage-length=208" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-faddrsig" "-o" "C:/Users/SVETLI~1.TOT/AppData/Local/Temp/test-6235c7.o" "-x" "c++" "test.cpp"
 "C:/Users/svetlin.totev/libs/mingw64/bin/clang.exe" "-cc1" "-triple" "x86_64-w64-windows-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-std=c++20" "-fdeprecated-macro" "-fdebug-compilation-dir=C:/Users/svetlin.totev/Documents/test" "-ferror-limit" "19" "-fmessage-length=208" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-faddrsig" "-x" "c++" "test-0047ff.cpp"

@shafik
Copy link
Collaborator

shafik commented Mar 27, 2024

Confirmed: https://godbolt.org/z/xjb96Edxr

Assertion

clang++: /root/llvm-project/clang/include/clang/AST/DeclarationName.h:503:
void* clang::DeclarationName::getFETokenInfo() const:
Assertion `getPtr() && "getFETokenInfo on an empty DeclarationName!"' failed.

Backtrace:

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/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.	<source>:6:20: current parser token ';'
2.	<source>:4:1: parsing function body 'main'
3.	<source>:4:1: in compound statement ('{}')
 #0 0x0000000003920cd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3920cd8)
 #1 0x000000000391e9bc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x391e9bc)
 #2 0x0000000003865258 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f938b842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f938b8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f938b842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f938b8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f938b82871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f938b839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000062f2087 clang::IdentifierResolver::begin(clang::DeclarationName) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62f2087)
#10 0x00000000064fd446 clang::Sema::PushOnScopeChains(clang::NamedDecl*, clang::Scope*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64fd446)
#11 0x00000000065fef54 clang::Sema::ActOnUsingEnumDeclaration(clang::Scope*, clang::AccessSpecifier, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo&, clang::CXXScopeSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65fef54)
#12 0x00000000062224ef clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62224ef)
#13 0x00000000062228a5 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62228a5)
#14 0x00000000062094ea clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62094ea)
#15 0x00000000062aaf8c clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62aaf8c)
#16 0x00000000062ac247 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62ac247)
#17 0x00000000062ad151 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62ad151)
#18 0x00000000062aea6a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62aea6a)
#19 0x00000000061c9b41 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61c9b41)
#20 0x00000000062011bc clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62011bc)
#21 0x00000000061bdade clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61bdade)
#22 0x00000000061be2d3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61be2d3)
#23 0x00000000061c5746 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61c5746)
#24 0x00000000061c65ed clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61c65ed)
#25 0x00000000061b92ca clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x61b92ca)
#26 0x00000000041bd968 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41bd968)
#27 0x000000000443cfe9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x443cfe9)
#28 0x00000000043c66de clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43c66de)
#29 0x000000000452009e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x452009e)
#30 0x0000000000c29b5c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc29b5c)
#31 0x0000000000c22dea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#32 0x00000000042008e9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#33 0x0000000003865704 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3865704)
#34 0x0000000004200edf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#35 0x00000000041c7275 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41c7275)
#36 0x00000000041c7cdd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41c7cdd)
#37 0x00000000041cfa45 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41cfa45)
#38 0x0000000000c26ff5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc26ff5)
#39 0x0000000000b1d474 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb1d474)
#40 0x00007f938b829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x00007f938b829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 0x0000000000c228de _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc228de)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@shafik shafik added the confirmed Verified by a second party label Mar 27, 2024
jcsxky added a commit that referenced this issue Apr 5, 2024
…87144)

Try to fix #86790
`getFETokenInfo` requires `DeclarationName` shouldn't be empty and this
will produce crash when checking name conflict of an anonymous
`NamedDecl` in `Sema::PushOnScopeChains` and whether it's a reserved
identifier or not. These wouldn't happen when it's a anonymous enum and
we can skip the checking and just add the declaration to current scope.

Co-authored-by: huqizhi <836744285@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants