Skip to content

[SR-12604] Crash creating unbound reference to protocol method #55048

@pcantrell

Description

@pcantrell
Previous ID SR-12604
Radar None
Original Reporter @pcantrell
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)

Target: x86_64-apple-darwin19.3.0

macOS 10.15.3

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

md5: 323e28bd2753a8b16c89cae1819af195

duplicates:

  • SR-75 Referencing a protocol function crashes the compiler

Issue Description:

This code:

protocol Pit {
    func pat()
}

Pit.pat

…causes a compiler crash:

0  lldb                     0x000000010cf1bf08 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  lldb                     0x000000010cf1b4c5 llvm::sys::RunSignalHandlers() + 85
2  lldb                     0x000000010cf1c550 SignalHandler(int) + 272
3  libsystem_platform.dylib 0x00007fff7160842d _sigtramp + 29
4  libsystem_platform.dylib 0x00007fc106e95d40 _sigtramp + 2508773680
5  LLDB                     0x000000011098742b swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 379
6  LLDB                     0x000000011098954c swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 4844
7  LLDB                     0x000000011097e586 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 22
8  LLDB                     0x0000000110926764 swift::Lowering::ArgumentSource::getAsRValue(swift::Lowering::SILGenFunction&, swift::Lowering::SGFContext) && + 36
9  LLDB                     0x00000001109ac27d swift::Lowering::SILGenFunction::emitAssignToLValue(swift::SILLocation, swift::Lowering::ArgumentSource&&, swift::Lowering::LValue&&) + 477
10 LLDB                     0x00000001109970b4 emitSimpleAssignment(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Expr*, swift::Expr*) + 836
11 LLDB                     0x000000011098ba1d swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 14269
12 LLDB                     0x0000000110980bdd swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 797
13 LLDB                     0x00000001109dbbd0 (anonymous namespace)::StmtEmitter::visitBraceStmt(swift::BraceStmt*) + 320
14 LLDB                     0x00000001109d8fca swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 10410
15 LLDB                     0x00000001109d6715 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
16 LLDB                     0x00000001109386a8 swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 344
17 LLDB                     0x0000000110938bc3 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 899
18 LLDB                     0x0000000110939728 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 216
19 LLDB                     0x0000000110939ad9 swift::performSILGeneration(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions&) + 25
20 LLDB                     0x000000011032f3e2 lldb_private::SwiftExpressionParser::Parse(lldb_private::DiagnosticManager&, unsigned int, unsigned int) + 5762
21 LLDB                     0x000000011033cc1a lldb_private::SwiftUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) + 1066
22 LLDB                     0x00000001100ceb5a lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::Status&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<lldb_private::Module>*, lldb_private::ValueObject*) + 1770
23 LLDB                     0x00000001100cca97 lldb_private::REPL::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 1847
24 LLDB                     0x0000000110044957 lldb_private::IOHandlerEditline::Run() + 375
25 LLDB                     0x000000011002cb89 lldb_private::Debugger::ExecuteIOHandlers() + 105
26 LLDB                     0x000000011002f463 lldb_private::Debugger::IOHandlerThread(void*) + 19
27 LLDB                     0x00000001100d6547 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 103
28 libsystem_pthread.dylib  0x00007fff71613e65 _pthread_start + 148
29 libsystem_pthread.dylib  0x00007fff7160f83b thread_start + 15
Segmentation fault: 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions