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-11877] Compiler crash on non-String param for dynamic member lookup #54292

Closed
hamishknight opened this issue Nov 30, 2019 · 1 comment
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-11877
Radar None
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.1.1-dev (Swift d2e1f09)
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: 5707079c4bef027f493c140e769c8e16

Issue Description:

The following hits an assertion:

@dynamicMemberLookup
struct S {
  subscript(dynamicMember member: Substring) -> Int { 0 }
}

_ = \S.okay

Stack trace:

Unhandled coercion
UNREACHABLE executed at /Users/hamishknight/Desktop/swift-dev/swift/lib/Sema/CSApply.cpp:6405!
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 -disable-objc-attr-requires-foundation-module
1.  Swift version 5.1.1-dev (Swift 7edbd9327e)
2.  While type-checking statement at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:701:1 - line:701:8] RangeText="_ = \S."
3.  While type-checking expression at [/Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift:701:1 - line:701:8] RangeText="_ = \S."
0  swift                    0x0000000105d0fd75 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000105d0ece8 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x0000000105d10376 SignalHandler(int) + 278
3  libsystem_platform.dylib 0x00007fff602c5b5d _sigtramp + 29
4  swift                    0x0000000107c55000 (anonymous namespace)::DarwinX86AsmBackend::getCompactUnwindRegNum(unsigned int) const::CU64BitRegs + 231410
5  libsystem_c.dylib        0x00007fff601856a6 abort + 127
6  swift                    0x0000000106f429de llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 462
7  swift                    0x000000010264c01f (anonymous namespace)::ExprRewriter::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::Optional<swift::Pattern*>) + 9679
8  swift                    0x000000010265f0c0 (anonymous namespace)::ExprRewriter::coerceCallArguments(swift::Expr*, swift::AnyFunctionType*, swift::ConcreteDeclRef, swift::ApplyExpr*, llvm::ArrayRef<swift::Identifier>, bool, swift::constraints::ConstraintLocatorBuilder) + 3104
9  swift                    0x0000000102663304 (anonymous namespace)::ExprRewriter::buildKeyPathSubscriptComponent(swift::constraints::SelectedOverload&, swift::SourceLoc, swift::Expr*, llvm::ArrayRef<swift::Identifier>, swift::constraints::ConstraintLocator*) + 1396
10 swift                    0x0000000102653f1c swift::ASTVisitor<(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void>::visit(swift::Expr*) + 24092
11 swift                    0x000000010264d976 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) + 22
12 swift                    0x0000000102b2dc92 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 2226
13 swift                    0x0000000102b2ce51 swift::Expr::walk(swift::ASTWalker&) + 81
14 swift                    0x00000001026496b5 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 453
15 swift                    0x00000001027a8012 swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 946
16 swift                    0x00000001027a7c4b swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 107
17 swift                    0x000000010284611b swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 7003
18 swift                    0x0000000102843120 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 128
19 swift                    0x0000000102843225 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 181
20 swift                    0x000000010286f07e swift::performTypeChecking(swift::SourceFile&, unsigned int) + 366
21 swift                    0x0000000101f99ccd swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t) + 413
22 swift                    0x0000000101f98972 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 418
23 swift                    0x0000000101f981dd swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 621
24 swift                    0x0000000101d7ad06 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 2022
25 swift                    0x0000000101d795a6 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3046
26 swift                    0x0000000101d1409e main + 734
27 libdyld.dylib            0x00007fff600e03d5 start + 1
28 libdyld.dylib            0x0000000000000008 start + 2683436084
fish: './swift -frontend -typecheck /U…' terminated by signal SIGABRT (Abort)
@hamishknight
Copy link
Collaborator Author

Fixed by #28512

@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

2 participants