Skip to content

[SR-6682] Conformance of base class to private protocol causes SIGABRT when derived class declared in second file #49231

@swift-ci

Description

@swift-ci
Previous ID SR-6682
Radar None
Original Reporter neightchan (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

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

md5: 513c6a73328d2e1d1ce702868a0e79f1

duplicates:

  • SR-2370 Compiler crash when subclassing in a different file a class which conforms to a fileprivate protocol

Issue Description:

With this code in one file:

private protocol P {}
class B : P {}

and the following code in another:

class D : B {}

compilation fails with the following error:

<unknown>:0: error: fatal error encountered while reading from module 'PrivateProtocolSecondFileSubclass'; please file a bug report with your project and the crash log

*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
top-level value not found
Cross-reference to module 'PrivateProtocolSecondFileSubclass'
... P

0  swift                    0x000000011279ddba PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000011279d1f6 SignalHandler(int) + 662
2  libsystem_platform.dylib 0x00007fff7af42f5a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000116a5e5f8 _sigtramp + 2612115128
4  libsystem_c.dylib        0x00007fff7ad6e32a abort + 127
5  swift                    0x000000010fe99c51 swift::ModuleFile::fatal(llvm::Error) + 1569
6  swift                    0x000000010fe9a102 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 130
7  swift                    0x000000010feafd34 swift::ModuleFile::readConformance(llvm::BitstreamCursor&, swift::GenericEnvironment*) + 644
8  swift                    0x000000010feb0186 swift::ModuleFile::readConformance(llvm::BitstreamCursor&, swift::GenericEnvironment*) + 1750
9  swift                    0x000000010feb3e3c swift::ModuleFile::loadAllConformances(swift::Decl const*, unsigned long long, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) + 300
10 swift                    0x00000001102f0d4c swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 1068
11 swift                    0x00000001102f0a17 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 247
12 swift                    0x00000001102f0a8c swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 364
13 swift                    0x00000001102f55c7 swift::ConformanceLookupTable::getAllProtocols(swift::NominalTypeDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolDecl*>&) + 39
14 swift                    0x000000010fa8061d (anonymous namespace)::NominalTypeWalker::walkToDeclPre(swift::Decl*) + 205
15 swift                    0x00000001102db988 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 280
16 swift                    0x000000010fb646cf swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1807
17 swift                    0x000000010fb6ad0f swift::runSILDiagnosticPasses(swift::SILModule&) + 175
18 swift                    0x000000010f110604 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13844
19 swift                    0x000000010f10b784 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7716
20 swift                    0x000000010f0c06a8 main + 12248
21 libdyld.dylib            0x00007fff7acc2145 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/Objects-normal/x86_64/main~partial.swiftmodule /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/Objects-normal/x86_64/second~partial.swiftmodule -parse-as-library -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Products/Debug -F /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Products/Debug -enable-testing -g -module-cache-path /Users/nate/Library/Developer/Xcode/DerivedData/ModuleCache -swift-version 3 -enforce-exclusivity=checked -serialize-debugging-options -Xcc -I/Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/PrivateProtocolSecondFileSubclass-generated-files.hmap -Xcc -I/Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/PrivateProtocolSecondFileSubclass-own-target-headers.hmap -Xcc -I/Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/PrivateProtocolSecondFileSubclass-all-target-headers.hmap -Xcc -iquote -Xcc /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/PrivateProtocolSecondFileSubclass-project-headers.hmap -Xcc -I/Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Products/Debug/include -Xcc -I/Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/DerivedSources/x86_64 -Xcc -I/Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/nate/projects/swift_crashes/two_file_private_protocol_conformance_subclass/Xcode/PrivateProtocolSecondFileSubclass -emit-module-doc-path /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/Objects-normal/x86_64/PrivateProtocolSecondFileSubclass.swiftdoc -module-name PrivateProtocolSecondFileSubclass -emit-objc-header-path /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/Objects-normal/x86_64/PrivateProtocolSecondFileSubclass-Swift.h -o /Users/nate/Library/Developer/Xcode/DerivedData/PrivateProtocolSecondFileSubclass-czslcrekusxfcobimuioblebmyql/Build/Intermediates.noindex/PrivateProtocolSecondFileSubclass.build/Debug/PrivateProtocolSecondFileSubclass.build/Objects-normal/x86_64/PrivateProtocolSecondFileSubclass.swiftmodule 
1.  While loading conformances for 'D' in module 'PrivateProtocolSecondFileSubclass'
2.  While reading inherited conformance for type 'D'
3.  While cross-referencing conformance for 'B' in module 'PrivateProtocolSecondFileSubclass'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions