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-12990] Crash on 5.3 and master in swift::DiagnosticEngine::diagnosticInfoForDiagnostic(swift::Diagnostic const&) #55435

Closed
nathawes opened this issue Jun 12, 2020 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself found by stress tester Flag: An issue found by the SourceKit stress tester

Comments

@nathawes
Copy link
Collaborator

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

md5: b0c6e6499e06a8e1448ccb708c9b9e53

Issue Description:

Reproducer:

class ContainerTransition {
  var viewControllers: [Int: String]?
  func completeTransition() {
    viewControllers?[Int//.max
  }
} 

Crashes on release build of 5.3 (not sure about release master). Master and 5.3 hit an assertion.

Trace without assertions (5.3):

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   swift                           0x000000010d4ede06 swift::DiagnosticEngine::diagnosticInfoForDiagnostic(swift::Diagnostic const&) + 310
1   swift                           0x000000010d4ed6ac swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 44
2   swift                           0x000000010cf59b1b swift::DiagnosticTransaction::~DiagnosticTransaction() + 155
3   swift                           0x000000010d055866 swift::constraints::ConstraintSystem::diagnoseAmbiguityWithFixes(llvm::SmallVectorImpl<swift::constraints::Solution>&) + 12934
4   swift                           0x000000010d051f60 swift::constraints::ConstraintSystem::salvage() + 416
5   swift                           0x000000010cfd23fd swift::constraints::ConstraintSystem::solve(swift::constraints::SolutionApplicationTarget&, swift::FreeTypeVariableBinding) + 1821
6   swift                           0x000000010d10fff1 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, bool&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 833
7   swift                           0x000000010d10fbf8 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 360
8   swift                           0x000000010d1f54cb swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 9115
9   swift                           0x000000010d1f0c7a bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 314
10  swift                           0x000000010d1ef54e swift::TypeCheckFunctionBodyUntilRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*, swift::SourceLoc) const + 2398
11  swift                           0x000000010d1f84fd llvm::Expected<swift::TypeCheckFunctionBodyUntilRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckFunctionBodyUntilRequest, (void*)0>(swift::TypeCheckFunctionBodyUntilRequest const&) + 925
12  swift                           0x000000010d1f06c8 swift::TypeCheckFunctionBodyUntilRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyUntilRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyUntilRequest, swift::TypeCheckFunctionBodyUntilRequest::OutputType) + 440
13  swift                           0x000000010d22ddb4 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 1252
14  swift                           0x000000010d2309c9 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 953
15  swift                           0x000000010d22d744 swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 164
16  swift                           0x000000010c3b0c47 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 6439
17  swift                           0x000000010c272ee1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6849
18  swift                           0x000000010c1f7a97 main + 1255
19  libdyld.dylib                   0x00007fff6b2e5cc9 start + 1

Trace with assertions (master)

Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm-project/llvm/include/llvm/Support/Casting.h, line 105.

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                           0x0000000108357981 swift::constraints::Solution::getFunctionArgApplyInfo(swift::constraints::ConstraintLocator*) const (.cold.4) + 33
6   swift                           0x00000001049f6f1e swift::constraints::Solution::getFunctionArgApplyInfo(swift::constraints::ConstraintLocator*) const + 1598
7   swift                           0x000000010499a043 swift::constraints::AllowArgumentMismatch::diagnose(swift::constraints::Solution const&, bool) const + 259
8   swift                           0x00000001049f2931 swift::constraints::ConstraintSystem::diagnoseAmbiguityWithFixes(llvm::SmallVectorImpl<swift::constraints::Solution>&) + 7505
9   swift                           0x00000001049f06de swift::constraints::ConstraintSystem::salvage() + 318
10  swift                           0x0000000104980cb2 swift::constraints::ConstraintSystem::solve(swift::constraints::SolutionApplicationTarget&, swift::FreeTypeVariableBinding) + 578
11  swift                           0x0000000104a7c668 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, bool&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 408
12  swift                           0x0000000104a7c437 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 87
13  swift                           0x0000000104b1dd95 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 2725
14  swift                           0x0000000104b1b1c0 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 128
15  swift                           0x0000000104b1a671 swift::TypeCheckFunctionBodyRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*) const + 1089
16  swift                           0x0000000104b21b16 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckFunctionBodyRequest>(swift::TypeCheckFunctionBodyRequest const&) + 598
17  swift                           0x0000000104b2164c llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 316
18  swift                           0x0000000104b214b6 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 118
19  swift                           0x0000000104b19ef5 swift::TypeCheckFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyRequest, swift::TypeCheckFunctionBodyRequest::OutputType) + 37
20  swift                           0x0000000104b19ea0 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 64
21  swift                           0x0000000104b4dd4e swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 382
22  swift                           0x0000000104b4ea65 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 453
23  swift                           0x0000000104b4e784 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 52
24  swift                           0x0000000104b4e6f6 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 118
25  swift                           0x0000000104b4dae0 swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 32
26  swift                           0x0000000103ebe78a swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref<void (swift::SourceFile&)>) + 90
27  swift                           0x0000000103ebe67a swift::CompilerInstance::performSema() + 74
28  swift                           0x0000000103de0e19 performCompile(swift::CompilerInstance&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2329
29  swift                           0x0000000103ddf519 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3529
30  swift                           0x0000000103d7bccd main + 861
31  libdyld.dylib                   0x00007fff6b2e5cc9 start + 1
@nathawes
Copy link
Collaborator Author

@swift-ci create

@theblixguy
Copy link
Collaborator

#32356

@theblixguy
Copy link
Collaborator

Fixed on master and cherry-picked to 5.3 branch. @nathawes could you please verify using next available snapshot? Thank you!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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 found by stress tester Flag: An issue found by the SourceKit stress tester
Projects
None yet
Development

No branches or pull requests

2 participants