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

Assertion failure when parsing invalid file #121980

Closed
MikailBag opened this issue Jan 7, 2025 · 4 comments · Fixed by #122065
Closed

Assertion failure when parsing invalid file #121980

MikailBag opened this issue Jan 7, 2025 · 4 comments · Fixed by #122065
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts confirmed Verified by a second party crash-on-invalid duplicate Resolved as duplicate

Comments

@MikailBag
Copy link

MikailBag commented Jan 7, 2025

Code: https://gist.github.com/MikailBag/76a27cb9bc497cb608adf358bc890c86

template < class >
concept __has_member_difference_type ;
template < __has_member_difference_type > struct incrementable_traits
template < class >
concept __has_integral_minus ;
template < __has_integral_minus _Tp >
struct incrementable_traits< _Tp > {

Error:

clang-20: /home/mb/projects/llvm-project/clang/lib/Sema/SemaConcept.cpp:1629:
static std::optional<NormalizedConstraint> clang::NormalizedConstraint::fromConstraintExpr(Sema &, NamedDecl *, const Expr *):
Assertion `E != nullptr' failed.

Full error:

Details
server.iim:2:38: error: expected '='
    2 | concept __has_member_difference_type ;
      |                                      ^
server.iim:3:70: error: expected ';' after struct
    3 | template < __has_member_difference_type > struct incrementable_traits
      |                                                                      ^
      |                                                                      ;
server.iim:5:30: error: expected '='
    5 | concept __has_integral_minus ;
      |                              ^
clang-20: /home/mb/projects/llvm-project/clang/lib/Sema/SemaConcept.cpp:1629: static std::optional<NormalizedConstraint> clang::NormalizedConstraint::fromConstraintExpr(Sema &, NamedDecl *, const Expr *): Assertion `E != nullptr' 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: /home/mb/projects/llvm-project/build/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-module-interface -disable-free -clear-ast-before-backend -main-file-name server.iim -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/tmp/rep -fcoverage-compilation-dir=/tmp/rep -resource-dir /home/mb/projects/llvm-project/build/lib/clang/20 -internal-isystem /home/mb/projects/llvm-project/build/bin/../include/x86_64-unknown-linux-gnu/c++/v1 -internal-isystem /home/mb/projects/llvm-project/build/bin/../include/c++/v1 -internal-isystem /home/mb/projects/llvm-project/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++23 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -disable-llvm-passes -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o out.pcm -x c++ server.iim
1.	server.iim:7:36: current parser token '{'
 #0 0x0000622d8f86b918 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/mb/projects/llvm-project/build/bin/clang-20+0x3e92918)
 #1 0x0000622d8f8693ce llvm::sys::RunSignalHandlers() (/home/mb/projects/llvm-project/build/bin/clang-20+0x3e903ce)
 #2 0x0000622d8f86c108 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007b2696845320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
 #4 0x00007b269689eb1c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007b269689eb1c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007b269689eb1c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007b269684526e raise ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007b26968288ff abort ./stdlib/abort.c:81:7
 #9 0x00007b269682881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007b269683b507 (/lib/x86_64-linux-gnu/libc.so.6+0x3b507)
#11 0x0000622d9187c889 clang::NormalizedConstraint::fromConstraintExpr(clang::Sema&, clang::NamedDecl*, clang::Expr const*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea3889)
#12 0x0000622d9187bad3 clang::NormalizedConstraint::fromConstraintExprs(clang::Sema&, clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea2ad3)
#13 0x0000622d9187b90e clang::Sema::getNormalizedAssociatedConstraints(clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea290e)
#14 0x0000622d9187c490 clang::NormalizedConstraint::fromConstraintExpr(clang::Sema&, clang::NamedDecl*, clang::Expr const*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea3490)
#15 0x0000622d9187bad3 clang::NormalizedConstraint::fromConstraintExprs(clang::Sema&, clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea2ad3)
#16 0x0000622d9187b90e clang::Sema::getNormalizedAssociatedConstraints(clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea290e)
#17 0x0000622d9187df29 clang::Sema::IsAtLeastAsConstrained(clang::NamedDecl*, llvm::MutableArrayRef<clang::Expr const*>, clang::NamedDecl*, llvm::MutableArrayRef<clang::Expr const*>, bool&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea4f29)
#18 0x0000622d91e9d4ba clang::Sema::isMoreSpecializedThanPrimary(clang::ClassTemplatePartialSpecializationDecl*, clang::sema::TemplateDeductionInfo&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x64c44ba)
#19 0x0000622d91e02c29 clang::Sema::CheckTemplatePartialSpecialization(clang::ClassTemplatePartialSpecializationDecl*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x6429c29)
#20 0x0000622d91e13e0d clang::Sema::ActOnClassTemplateSpecialization(clang::Scope*, unsigned int, clang::TagUseKind, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, clang::TemplateIdAnnotation&, clang::ParsedAttributesView const&, llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::SkipBodyInfo*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x643ae0d)
#21 0x0000622d9167eee5 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ca5ee5)
#22 0x0000622d916a2089 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5cc9089)
#23 0x0000622d9166d372 clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c94372)
#24 0x0000622d9166c421 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c93421)
#25 0x0000622d9166bd65 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c92d65)
#26 0x0000622d9169c1b4 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5cc31b4)
#27 0x0000622d9162a1d9 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c511d9)
#28 0x0000622d916289b3 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c4f9b3)
#29 0x0000622d9162483e clang::ParseAST(clang::Sema&, bool, bool) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c4b83e)
#30 0x0000622d9053a1cf clang::FrontendAction::Execute() (/home/mb/projects/llvm-project/build/bin/clang-20+0x4b611cf)
#31 0x0000622d904aaf7d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x4ad1f7d)
#32 0x0000622d9061a79a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x4c4179a)
#33 0x0000622d8e5648a1 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b8b8a1)
#34 0x0000622d8e560989 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#35 0x0000622d8e55fa96 clang_main(int, char**, llvm::ToolContext const&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b86a96)
#36 0x0000622d8e56fa47 main (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b96a47)
#37 0x00007b269682a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#38 0x00007b269682a28b call_init ./csu/../csu/libc-start.c:128:20
#39 0x00007b269682a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#40 0x0000622d8e55e565 _start (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b85565)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 20.0.0git (https://github.com/llvm/llvm-project.git 17c8c1c5098bd1fa68809d686867d01d56d5e564)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/mb/projects/llvm-project/build/bin
Build config: +assertions
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/server-7f8035.cppm
clang++: note: diagnostic msg: /tmp/server-7f8035.sh
clang++: note: diagnostic msg: 

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

I am using clang which I've built myself (from clean source tree), but failure reproduces on Godbolt as well: https://godbolt.org/z/E5Ev993hK

Context: I was trying to reduce reproducer #118137, but apparently ran into unrelated problem 😐

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jan 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 7, 2025

@llvm/issue-subscribers-clang-frontend

Author: Mikail Bagishov (MikailBag)

Code: https://gist.github.com/MikailBag/76a27cb9bc497cb608adf358bc890c86

Error:

clang-20: /home/mb/projects/llvm-project/clang/lib/Sema/SemaConcept.cpp:1629: static std::optional&lt;NormalizedConstraint&gt; clang::NormalizedConstraint::fromConstraintExpr(Sema &amp;, NamedDecl *, const Expr *): Assertion `E != nullptr' failed.

Full error:
<details><summary>Details</summary>
<p>

server.iim:2:38: error: expected '='
2 | concept __has_member_difference_type ;
| ^
server.iim:3:70: error: expected ';' after struct
3 | template < __has_member_difference_type > struct incrementable_traits
| ^
| ;
server.iim:5:30: error: expected '='
5 | concept __has_integral_minus ;
| ^
clang-20: /home/mb/projects/llvm-project/clang/lib/Sema/SemaConcept.cpp:1629: static std::optional<NormalizedConstraint> clang::NormalizedConstraint::fromConstraintExpr(Sema &, NamedDecl *, const Expr *): Assertion `E != nullptr' 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: /home/mb/projects/llvm-project/build/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-module-interface -disable-free -clear-ast-before-backend -main-file-name server.iim -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/tmp/rep -fcoverage-compilation-dir=/tmp/rep -resource-dir /home/mb/projects/llvm-project/build/lib/clang/20 -internal-isystem /home/mb/projects/llvm-project/build/bin/../include/x86_64-unknown-linux-gnu/c++/v1 -internal-isystem /home/mb/projects/llvm-project/build/bin/../include/c++/v1 -internal-isystem /home/mb/projects/llvm-project/build/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++23 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -disable-llvm-passes -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o out.pcm -x c++ server.iim

  1. server.iim:7:36: current parser token '{'
    #0 0x0000622d8f86b918 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/mb/projects/llvm-project/build/bin/clang-20+0x3e92918)
    #1 0x0000622d8f8693ce llvm::sys::RunSignalHandlers() (/home/mb/projects/llvm-project/build/bin/clang-20+0x3e903ce)
    #2 0x0000622d8f86c108 SignalHandler(int) Signals.cpp:0:0
    #3 0x00007b2696845320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
    #4 0x00007b269689eb1c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
    #5 0x00007b269689eb1c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
    #6 0x00007b269689eb1c pthread_kill ./nptl/pthread_kill.c:89:10
    #7 0x00007b269684526e raise ./signal/../sysdeps/posix/raise.c:27:6
    #8 0x00007b26968288ff abort ./stdlib/abort.c:81:7
    #9 0x00007b269682881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
    #10 0x00007b269683b507 (/lib/x86_64-linux-gnu/libc.so.6+0x3b507)
    #11 0x0000622d9187c889 clang::NormalizedConstraint::fromConstraintExpr(clang::Sema&, clang::NamedDecl*, clang::Expr const*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea3889)
    #12 0x0000622d9187bad3 clang::NormalizedConstraint::fromConstraintExprs(clang::Sema&, clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea2ad3)
    #13 0x0000622d9187b90e clang::Sema::getNormalizedAssociatedConstraints(clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea290e)
    #14 0x0000622d9187c490 clang::NormalizedConstraint::fromConstraintExpr(clang::Sema&, clang::NamedDecl*, clang::Expr const*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea3490)
    #15 0x0000622d9187bad3 clang::NormalizedConstraint::fromConstraintExprs(clang::Sema&, clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea2ad3)
    #16 0x0000622d9187b90e clang::Sema::getNormalizedAssociatedConstraints(clang::NamedDecl*, llvm::ArrayRef<clang::Expr const*>) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea290e)
    #17 0x0000622d9187df29 clang::Sema::IsAtLeastAsConstrained(clang::NamedDecl*, llvm::MutableArrayRef<clang::Expr const*>, clang::NamedDecl*, llvm::MutableArrayRef<clang::Expr const*>, bool&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ea4f29)
    #18 0x0000622d91e9d4ba clang::Sema::isMoreSpecializedThanPrimary(clang::ClassTemplatePartialSpecializationDecl*, clang::sema::TemplateDeductionInfo&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x64c44ba)
    #19 0x0000622d91e02c29 clang::Sema::CheckTemplatePartialSpecialization(clang::ClassTemplatePartialSpecializationDecl*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x6429c29)
    #20 0x0000622d91e13e0d clang::Sema::ActOnClassTemplateSpecialization(clang::Scope*, unsigned int, clang::TagUseKind, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, clang::TemplateIdAnnotation&, clang::ParsedAttributesView const&, llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::SkipBodyInfo*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x643ae0d)
    #21 0x0000622d9167eee5 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5ca5ee5)
    #22 0x0000622d916a2089 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5cc9089)
    #23 0x0000622d9166d372 clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c94372)
    #24 0x0000622d9166c421 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c93421)
    #25 0x0000622d9166bd65 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c92d65)
    #26 0x0000622d9169c1b4 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5cc31b4)
    #27 0x0000622d9162a1d9 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c511d9)
    #28 0x0000622d916289b3 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c4f9b3)
    #29 0x0000622d9162483e clang::ParseAST(clang::Sema&, bool, bool) (/home/mb/projects/llvm-project/build/bin/clang-20+0x5c4b83e)
    #30 0x0000622d9053a1cf clang::FrontendAction::Execute() (/home/mb/projects/llvm-project/build/bin/clang-20+0x4b611cf)
    #31 0x0000622d904aaf7d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x4ad1f7d)
    #32 0x0000622d9061a79a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x4c4179a)
    #33 0x0000622d8e5648a1 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b8b8a1)
    #34 0x0000622d8e560989 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
    #35 0x0000622d8e55fa96 clang_main(int, char**, llvm::ToolContext const&) (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b86a96)
    #36 0x0000622d8e56fa47 main (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b96a47)
    #37 0x00007b269682a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
    #38 0x00007b269682a28b call_init ./csu/../csu/libc-start.c:128:20
    #39 0x00007b269682a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
    #40 0x0000622d8e55e565 _start (/home/mb/projects/llvm-project/build/bin/clang-20+0x2b85565)
    clang++: error: unable to execute command: Aborted (core dumped)
    clang++: error: clang frontend command failed due to signal (use -v to see invocation)
    clang version 20.0.0git (https://github.com/llvm/llvm-project.git 17c8c1c)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /home/mb/projects/llvm-project/build/bin
    Build config: +assertions
    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/server-7f8035.cppm
clang++: note: diagnostic msg: /tmp/server-7f8035.sh
clang++: note: diagnostic msg:


</p>
</details>

I am using clang which I've built myself (from clean source tree), but failure reproduces on Godbolt as well: https://godbolt.org/z/E5Ev993hK

Context: I was trying to reduce reproducer #118137, but apparently ran into unrelated problem 😐

@shafik
Copy link
Collaborator

shafik commented Jan 7, 2025

Looks like a clang-trunk regression: https://godbolt.org/z/cezMd94cc

@shafik shafik added the confirmed Verified by a second party label Jan 7, 2025
@shafik
Copy link
Collaborator

shafik commented Jan 8, 2025

@zyn0217 git bisect identifier 03229e7 as the cause of this regression

@zyn0217
Copy link
Contributor

zyn0217 commented Jan 8, 2025

@shafik this looks like a duplicate of #115004

@shafik shafik closed this as completed Jan 8, 2025
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Jan 8, 2025
zyn0217 added a commit that referenced this issue Jan 8, 2025
After 0dedd6f and 03229e7, invalid concept declarations might lack
expressions for evaluation and normalization. This could make it crash
in certain scenarios, apart from the one of evaluation concepts showed
in 03229e7, there's also an issue when checking specializations where
the normalization also relies on a non-null expression.

This patch prevents that by avoiding building up a type constraint in
such situations, thereafter the template parameter wouldn't have a
concept specialization of a null expression.

With this patch, the assumption in ASTWriterDecl is no longer valid.
Namely, HasConstraint and TypeConstraintInitialized must now represent
different meanings for both source fidelity and semantic requirements.

Fixes #115004
Fixes #121980
@EugeneZelenko EugeneZelenko added crash-on-invalid concepts C++20 concepts and removed crash Prefer [crash-on-valid] or [crash-on-invalid] labels Jan 8, 2025
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" concepts C++20 concepts confirmed Verified by a second party crash-on-invalid duplicate Resolved as duplicate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants