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-11609] Compiler crash on missing conformance for default param #54017

Closed
hamishknight opened this issue Oct 13, 2019 · 4 comments
Closed
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 type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-11609
Radar rdar://problem/56234611
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.1.1-dev (LLVM 6e04008c7f, Swift 033e31d)
Target: x86_64-apple-darwin18.5.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee @hamishknight
Priority Medium

md5: 898237f6d32d9dedca6f5eeaf3f2076d

Issue Description:

The following hits an array out of bounds assertion:

protocol P {
  init()
}

func foo<T : P>(_ x: T = .init()) -> T { x }
let x: String = foo()

Stack dump:

Assertion failed: (Index < Length && "Invalid index!"), function operator[], file /Users/hamishknight/Desktop/swift-dev/llvm/include/llvm/ADT/ArrayRef.h, line 240.
Stack dump:
0.  Program arguments: ./swift -frontend -typecheck /Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -debug-diagnostic-names
1.  Swift version 5.1.1-dev (LLVM 6e04008c7f, Swift 033e31d3cb)
2.  While type-checking statement at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:424:1 - line:424:21] RangeText="let x: String = foo("
3.  While type-checking declaration 0x7f99f4040eb0 (at /Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:424:1)
4.  While type-checking expression at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:424:17 - line:424:21] RangeText="foo("
0  swift                    0x000000010a2eefc5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010a2edfc8 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x000000010a2ef5b8 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff72f86b5d _sigtramp + 29
4  swift                    0x000000010c7fd5a8 cmark_strbuf__initbuf + 148211
5  libsystem_c.dylib        0x00007fff72e466a6 abort + 127
6  libsystem_c.dylib        0x00007fff72e0f20d basename_r + 0
7  swift                    0x000000010a58ec63 swift::constraints::MissingConformanceFailure::diagnoseAsError() (.cold.7) + 35
8  swift                    0x0000000106cb07ab swift::constraints::MissingConformanceFailure::diagnoseAsError() + 1051
9  swift                    0x0000000106ca8b1b swift::constraints::MissingConformance::diagnose(swift::Expr*, bool) const + 123
10 swift                    0x0000000106c19d64 swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&)::DiagnosticWalker::diagnose(swift::Expr*) + 276
11 swift                    0x0000000106c194c6 swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&)::DiagnosticWalker::walkToExprPre(swift::Expr*) + 246
12 swift                    0x0000000107155f44 (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 36
13 swift                    0x0000000107153131 swift::Expr::walk(swift::ASTWalker&) + 81
14 swift                    0x0000000106c15f02 swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&) + 530
15 swift                    0x0000000106c1605d swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 141
16 swift                    0x0000000106d6b34f swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 1135
17 swift                    0x0000000106d6c9e2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 1010
18 swift                    0x0000000106d6cce1 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 193
19 swift                    0x0000000106d8cc9a swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 7370
20 swift                    0x0000000106d85cd7 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 167
21 swift                    0x0000000106d85c26 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
22 swift                    0x0000000106e0a1d7 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 407
23 swift                    0x0000000106e08bf8 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
24 swift                    0x0000000106e08cf5 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 181
25 swift                    0x0000000106e35852 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1682
26 swift                    0x000000010658d249 swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 489
27 swift                    0x000000010658bea7 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 519
28 swift                    0x000000010658b6ad swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 621
29 swift                    0x0000000106371a52 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1650
30 swift                    0x0000000106370476 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3046
31 swift                    0x0000000106315a09 main + 729
32 libdyld.dylib            0x00007fff72da13d5 start + 1
fish: './swift -frontend -typecheck /U…' terminated by signal SIGABRT (Abort)
@hamishknight
Copy link
Collaborator Author

cc @xedin

@xedin
Copy link
Member

xedin commented Oct 14, 2019

@swift-ci create

@xedin
Copy link
Member

xedin commented Oct 14, 2019

Fixed by #27660 Please verify using the next available nightly snapshot of master.

@hamishknight
Copy link
Collaborator Author

Thanks Pavel!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants