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

Crash on invalid nested call to variadic generic function #78156

Open
AnthonyLatsis opened this issue Dec 13, 2024 · 0 comments
Open

Crash on invalid nested call to variadic generic function #78156

AnthonyLatsis opened this issue Dec 13, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software expressions Feature: expressions generics Feature: generic declarations and types parameter packs Feature → generics: Parameter packs swift 6.1 type checker Area → compiler: Semantic analysis

Comments

@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Dec 13, 2024

Description

No response

Reproduction

func f<each T>(_ seqs: repeat [each T]) -> (repeat [each T], Bool) {}
let _ = f(f(f([4])))

Stack dump

Stack dump:
1.	Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
2.	Compiling with effective version 5.10
3.	While evaluating request TypeCheckSourceFileRequest(source_file "/Users/anthonylatsis/Desktop/test.swift")
4.	While type-checking statement at [/Users/anthonylatsis/Desktop/test.swift:392:1 - line:392:20] RangeText="let _ = f(f(f([4]))"
5.	While type-checking declaration 0x1471d4940 (at /Users/anthonylatsis/Desktop/test.swift:392:1)
6.	While evaluating request PatternBindingEntryRequest((unknown decl), 0)
7.	While type-checking expression at [/Users/anthonylatsis/Desktop/test.swift:392:9 - line:392:20] RangeText="f(f(f([4]))"
8.	While type-checking-target starting at /Users/anthonylatsis/Desktop/test.swift:392:9
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x00000001081269ac llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000108124c00 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108126f78 SignalHandler(int) + 292
3  libsystem_platform.dylib 0x00000001814b16a4 _sigtramp + 56
4  swift-frontend           0x0000000103ca2a44 swift::constraints::ArgumentMismatchFailure::diagnoseAsError() + 3120
5  swift-frontend           0x0000000103ca2a44 swift::constraints::ArgumentMismatchFailure::diagnoseAsError() + 3120
6  swift-frontend           0x0000000103c8487c swift::constraints::AllowArgumentMismatch::diagnose(swift::constraints::Solution const&, bool) const + 352
7  swift-frontend           0x0000000103b8cdd0 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::constraints::SyntacticElementTarget) + 5424
8  swift-frontend           0x0000000103e4cc58 swift::TypeChecker::typeCheckTarget(swift::constraints::SyntacticElementTarget&, swift::optionset::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 680
9  swift-frontend           0x0000000103e4c88c swift::TypeChecker::typeCheckExpression(swift::constraints::SyntacticElementTarget&, swift::optionset::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 416
10 swift-frontend           0x0000000103e4dec8 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, swift::Type, swift::PatternBindingDecl*, unsigned int, swift::optionset::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 172
11 swift-frontend           0x0000000103e4e158 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int, swift::Type, swift::optionset::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 356
12 swift-frontend           0x0000000103f46d88 swift::PatternBindingEntryRequest::evaluate(swift::Evaluator&, swift::PatternBindingDecl*, unsigned int) const + 3264
13 swift-frontend           0x00000001042d39a8 swift::PatternBindingEntryRequest::OutputType swift::Evaluator::getResultUncached<swift::PatternBindingEntryRequest, swift::PatternBindingEntryRequest::OutputType swift::evaluateOrDefault<swift::PatternBindingEntryRequest>(swift::Evaluator&, swift::PatternBindingEntryRequest, swift::PatternBindingEntryRequest::OutputType)::'lambda'()>(swift::PatternBindingEntryRequest const&, swift::PatternBindingEntryRequest::OutputType swift::evaluateOrDefault<swift::PatternBindingEntryRequest>(swift::Evaluator&, swift::PatternBindingEntryRequest, swift::PatternBindingEntryRequest::OutputType)::'lambda'()) + 624
14 swift-frontend           0x0000000104297098 swift::PatternBindingDecl::getCheckedPatternBindingEntry(unsigned int) const + 144
15 swift-frontend           0x0000000103ea0b54 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2552
16 swift-frontend           0x0000000103ea014c swift::TypeChecker::typeCheckDecl(swift::Decl*) + 152
17 swift-frontend           0x0000000103f3cf2c swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 288
18 swift-frontend           0x0000000103f3a86c bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 316
19 swift-frontend           0x0000000103f3aa48 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 148
20 swift-frontend           0x0000000103f87330 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 696
21 swift-frontend           0x0000000103f8e970 swift::TypeCheckSourceFileRequest::OutputType swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType)::'lambda'()>(swift::TypeCheckSourceFileRequest const&, swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType)::'lambda'()) + 620
22 swift-frontend           0x0000000103f8705c swift::performTypeChecking(swift::SourceFile&) + 328
23 swift-frontend           0x0000000102ea4ce0 swift::CompilerInstance::performSema() + 260
24 swift-frontend           0x0000000102ad2388 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 2216
25 swift-frontend           0x0000000102ad0ea0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3572
26 swift-frontend           0x0000000102a57f64 swift::mainEntry(int, char const**) + 3680
27 dyld                     0x00000001810e569c start + 4800
Segmentation fault: 11

Expected behavior

Error.

Environment

Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)

Additional information

No response

@AnthonyLatsis AnthonyLatsis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself type checker Area → compiler: Semantic analysis generics Feature: generic declarations and types crash Bug: A crash, i.e., an abnormal termination of software expressions Feature: expressions parameter packs Feature → generics: Parameter packs swift 6.1 labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software expressions Feature: expressions generics Feature: generic declarations and types parameter packs Feature → generics: Parameter packs swift 6.1 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

1 participant