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

[SR-12964] Assertion failed: (bool(anchor) && "Expected an anchor!"), function getCalleeLocator #55410

Closed
nathawes opened this issue Jun 9, 2020 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software found by stress tester Flag: An issue found by the SourceKit stress tester type checker Area → compiler: Semantic analysis

Comments

@nathawes
Copy link
Collaborator

nathawes commented Jun 9, 2020

Previous ID SR-12964
Radar rdar://problem/64168162
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Crash, FoundByStressTester
Assignee @hamishknight
Priority Medium

md5: 43603a302cfb68115204c2de5f34eee6

Issue Description:

Reproduces compiling the below with the latest master snapshot:

public protocol MyProto { }
public typealias MyAlias = (MyProto) -> Void
let x: MyAlias! = [1,2,3]
  .reversed()
  .reduce(

It also crashes sourcekitd.

Trace:

1.  Apple Swift version 5.3-dev (LLVM f516ac602c, Swift 09ea5fd1f7)
2.  While evaluating request TypeCheckSourceFileRequest(source_file "/tmp/sdsdfsddsfds/sdsdfsddsfds/main.swift")
3.  While type-checking statement at [/tmp/sdsdfsddsfds/sdsdfsddsfds/main.swift:9:1 - line:11:10] RangeText="let x: MyAlias! = [1,2,3]
  .reversed()
  .reduce"
4.  While type-checking declaration 0x7fb23a03df00 (at /tmp/sdsdfsddsfds/sdsdfsddsfds/main.swift:9:1)
5.  While type-checking expression at [/tmp/sdsdfsddsfds/sdsdfsddsfds/main.swift:9:19 - line:11:10] RangeText="[1,2,3]
  .reversed()
  .reduce"
 
Assertion failed: (bool(anchor) && "Expected an anchor!"), function getCalleeLocator, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/Sema/ConstraintSystem.cpp, line 448.
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff6b42d33a __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff6b4e9e60 pthread_kill + 430
2   libsystem_c.dylib               0x00007fff6b3b48a2 __abort + 139
3   libsystem_c.dylib               0x00007fff6b3b4817 abort + 135
4   libsystem_c.dylib               0x00007fff6b3b3ac6 __assert_rtn + 314
5   swift                           0x0000000114410143 swift::constraints::ConstraintSystem::getCalleeLocator(swift::constraints::ConstraintLocator*, bool, llvm::function_ref<swift::Type (swift::Expr*)>, llvm::function_ref<swift::Type (swift::Type)>, llvm::function_ref<llvm::Optional<swift::constraints::SelectedOverload> (swift::constraints::ConstraintLocator*)>) (.cold.13) + 35
6   swift                           0x0000000110aaba09 swift::constraints::ConstraintSystem::getCalleeLocator(swift::constraints::ConstraintLocator*, bool, llvm::function_ref<swift::Type (swift::Expr*)>, llvm::function_ref<swift::Type (swift::Type)>, llvm::function_ref<llvm::Optional<swift::constraints::SelectedOverload> (swift::constraints::ConstraintLocator*)>) + 1481
7   swift                           0x0000000110abaac6 swift::constraints::ConstraintSystem::findSelectedOverloadFor(swift::Expr*) + 150
8   swift                           0x0000000110a255c1 swift::constraints::ConstraintSystem::repairFailures(swift::Type, swift::Type, swift::constraints::ConstraintKind, llvm::SmallVectorImpl<swift::constraints::RestrictionOrFix>&, swift::constraints::ConstraintLocatorBuilder)::$_17::operator()(swift::Type, swift::Type) const + 305
9   swift                           0x0000000110a215f9 swift::constraints::ConstraintSystem::repairFailures(swift::Type, swift::Type, swift::constraints::ConstraintKind, llvm::SmallVectorImpl<swift::constraints::RestrictionOrFix>&, swift::constraints::ConstraintLocatorBuilder) + 6857
10  swift                           0x0000000110a19930 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 11120
11  swift                           0x0000000110a37f5a swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 2058
12  swift                           0x0000000110a414b7 swift::constraints::ConstraintSystem::simplify(bool) + 103
13  swift                           0x00000001109f29eb swift::constraints::TypeVariableBinding::attempt(swift::constraints::ConstraintSystem&) const + 667
14  swift                           0x0000000110a53fe5 swift::constraints::BindingStep<swift::constraints::TypeVarBindingProducer>::take(bool) + 437
15  swift                           0x0000000110a53dcd swift::constraints::TypeVariableStep::resume(bool) + 301
16  swift                           0x0000000110a430e9 swift::constraints::ConstraintSystem::solveImpl(llvm::SmallVectorImpl<swift::constraints::Solution>&) + 361
17  swift                           0x0000000110ab3714 swift::constraints::ConstraintSystem::salvage() + 276
18  swift                           0x0000000110a448a2 swift::constraints::ConstraintSystem::solve(swift::constraints::SolutionApplicationTarget&, swift::FreeTypeVariableBinding) + 578
19  swift                           0x0000000110b3f3e4 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, bool&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 468
20  swift                           0x0000000110b3f7c8 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, swift::Type, swift::PatternBindingDecl*, unsigned int) + 120
21  swift                           0x0000000110b3fa53 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int, swift::Type) + 371
22  swift                           0x0000000110b72089 swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 3065
23  swift                           0x0000000110b70caf (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 159
24  swift                           0x0000000110b70bf2 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 130
25  swift                           0x0000000110be030a swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 2426
26  swift                           0x0000000110bdd860 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 128
27  swift                           0x0000000110bdd94e swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 158
28  swift                           0x0000000110c1020f swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 239
29  swift                           0x0000000110c10fa5 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 453
30  swift                           0x0000000110c10cd4 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 52
31  swift                           0x0000000110c10c46 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 118
32  swift                           0x0000000110c10030 swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 32
33  swift                           0x000000010ff8697a swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref<void (swift::SourceFile&)>) + 90
34  swift                           0x000000010ff86531 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t, swift::OptionSet<swift::SourceFile::ParsingFlags, unsigned char>) + 625
35  swift                           0x000000010feaad68 performCompile(swift::CompilerInstance&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2328
36  swift                           0x000000010fea9469 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3529
37  swift                           0x000000010fe45c3d main + 861
38  libdyld.dylib                   0x00007fff6b2e5cc9 start + 1
@nathawes
Copy link
Collaborator Author

nathawes commented Jun 9, 2020

@swift-ci create

@hamishknight
Copy link
Collaborator

Fixed by #32278

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added type checker Area → compiler: Semantic analysis CompilerCrash labels Sep 17, 2022
This issue was closed.
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 in itself crash Bug: A crash, i.e., an abnormal termination of software found by stress tester Flag: An issue found by the SourceKit stress tester type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants