Skip to content

[SR-10490] SIL Crash on Conditional Conformance for Self Conforming Types #52890

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-10490
Radar rdar://problem/50170209
Original Reporter calebkleveter (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0

REPL or Xcode 10.2 (10E125)

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

md5: 587fa7fd924631e1c4601d7f477e1e2e

is duplicated by:

  • SR-10583 Segmentation fault: 11 starting from Swift 5

Issue Description:

If I try to compile the following code:

struct Foo<T> where T: Error { }
extension Array: Error where Element: Error { }
var foo: Foo<[Error]> = Foo()

The compiler crashes and I get the following stack-trace:

0 lldb 0x0000000100293f95 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 lldb 0x0000000100293347 llvm::sys::RunSignalHandlers() + 39
2 lldb 0x00000001002945f2 SignalHandler(int) + 258
3 libsystem_platform.dylib 0x00007fff7ea47b5d _sigtramp + 29
4 libsystem_platform.dylib 0x00007fe0209c9201 _sigtramp + 2717390529
5 LLDB 0x0000000103d150df swift::Mangle::ASTMangler::appendConcreteProtocolConformance(swift::ProtocolConformance const*) + 31
6 LLDB 0x0000000103d152b9 swift::Mangle::ASTMangler::appendConcreteProtocolConformance(swift::ProtocolConformance const*) + 505
7 LLDB 0x0000000103d13f13 swift::Mangle::ASTMangler::appendRetroactiveConformances(swift::Type) + 355
8 LLDB 0x0000000103d11ab4 swift::Mangle::ASTMangler::appendType(swift::Type) + 3204
9 LLDB 0x0000000103d12d73 swift::Mangle::ASTMangler::appendDeclType(swift::ValueDecl const*, bool) + 131
10 LLDB 0x0000000103d0f443 swift::Mangle::ASTMangler::appendAccessorEntity(llvm::StringRef, swift::AbstractStorageDecl const*, bool) + 131
11 LLDB 0x0000000103d109b6 swift::Mangle::ASTMangler::mangleGlobalVariableFull(swift::VarDecl const*) + 86
12 LLDB 0x0000000104231990 swift::Lowering::SILGenModule::getSILGlobalVariable(swift::VarDecl*, swift::ForDefinition_t) + 560
13 LLDB 0x00000001042069b0 swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*, bool) + 608
14 LLDB 0x0000000104208116 swift::ASTVisitor<(anonymous namespace)::InitializationForPattern, void, void, void, std::__1::unique_ptr<swift::Lowering::Initialization, std::__1::default_delete<swift::Lowering::Initialization> >, void, void>::visit(swift::Pattern*) + 614
15 LLDB 0x0000000104207fd0 swift::ASTVisitor<(anonymous namespace)::InitializationForPattern, void, void, void, std::__1::unique_ptr<swift::Lowering::Initialization, std::__1::default_delete<swift::Lowering::Initialization> >, void, void>::visit(swift::Pattern*) + 288
16 LLDB 0x000000010420755b swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 91
17 LLDB 0x00000001042076dd swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
18 LLDB 0x00000001041cacef swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 447
19 LLDB 0x00000001041cb3fc swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 860
20 LLDB 0x00000001041cc09f swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 287
21 LLDB 0x00000001041cc4ac swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&) + 28
22 LLDB 0x0000000104c03cba lldb_private::SwiftExpressionParser::Parse(lldb_private::DiagnosticManager&, unsigned int, unsigned int, unsigned int) + 6114
23 LLDB 0x0000000104c4e2f7 lldb_private::SwiftUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool, unsigned int) + 911
24 LLDB 0x00000001049e966f lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::Status&, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<lldb_private::Module>*) + 1361
25 LLDB 0x00000001048a9bbd lldb_private::REPL::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 1863
26 LLDB 0x000000010493b67e lldb_private::IOHandlerEditline::Run() + 338
27 LLDB 0x0000000104806168 lldb_private::Debugger::ExecuteIOHandlers() + 68
28 LLDB 0x0000000104808de8 lldb_private::Debugger::IOHandlerThread(void*) + 14
29 LLDB 0x0000000104a4791b lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105
30 libsystem_pthread.dylib 0x00007fff7ea502eb _pthread_body + 126
31 libsystem_pthread.dylib 0x00007fff7ea53249 _pthread_start + 66
32 libsystem_pthread.dylib 0x00007fff7ea4f40d thread_start + 13

I'm not 100% percent sure but I think this has to do with conditional conformance for protocols that conform to themselves.

Metadata

Metadata

Assignees

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 softwaremanglingArea → compiler: Mangling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions