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-6665] Compiler crash with "top-level value not found" #49214

Closed
lilyball mannequin opened this issue Dec 27, 2017 · 1 comment
Closed

[SR-6665] Compiler crash with "top-level value not found" #49214

lilyball mannequin opened this issue Dec 27, 2017 · 1 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 serialization Area → compiler: Serialization & deserialization

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Dec 27, 2017

Previous ID SR-6665
Radar None
Original Reporter @lilyball
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Xcode 9.2 (9C40b)

Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9

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

md5: 62e9e28282fa798288f179b0bd8b8f2c

duplicates:

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

Issue Description:

The compiler crashes if you have a class that inherits from a class in a different file, where the parent class conforms to a private protocol.

For example:

// Parent.swift
public class Parent: PrivateProto {
}

private protocol PrivateProto {
}
// Child.swift
public class Child: Parent {
}

I'm doing this in a framework target. I haven't tried in an app target. Similarly I'm compiling this in Debug mode; I'm assuming WMO would "fix" this issue but I haven't tested.

<unknown>:0: error: fatal error encountered while reading from module 'CrashTest'; 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 'CrashTest'
... PrivateProto

0  swift                    0x000000010af9d36a PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010af9c7a6 SignalHandler(int) + 662
2  libsystem_platform.dylib 0x00007fff54737f5a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000119380558 _sigtramp + 3301213720
4  libsystem_c.dylib        0x00007fff54562312 abort + 127
5  swift                    0x0000000108694231 swift::ModuleFile::fatal(llvm::Error) + 1569
6  swift                    0x00000001086946e2 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 130
7  swift                    0x00000001086aa2f1 swift::ModuleFile::readConformance(llvm::BitstreamCursor&, swift::GenericEnvironment*) + 625
8  swift                    0x00000001086aa739 swift::ModuleFile::readConformance(llvm::BitstreamCursor&, swift::GenericEnvironment*) + 1721
9  swift                    0x00000001086ad75c swift::ModuleFile::loadAllConformances(swift::Decl const*, unsigned long long, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) + 300
10 swift                    0x0000000108aef6dc swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 1068
11 swift                    0x0000000108aef3a7 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 247
12 swift                    0x0000000108aef41c swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 364
13 swift                    0x0000000108af3f57 swift::ConformanceLookupTable::getAllProtocols(swift::NominalTypeDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolDecl*>&) + 39
14 swift                    0x0000000108277ebd (anonymous namespace)::NominalTypeWalker::walkToDeclPre(swift::Decl*) + 205
15 swift                    0x0000000108ada218 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 280
16 swift                    0x000000010835c24f swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1807
17 swift                    0x000000010836288f swift::runSILDiagnosticPasses(swift::SILModule&) + 175
18 swift                    0x00000001078fa03f performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13791
19 swift                    0x00000001078f51f4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7716
20 swift                    0x00000001078a9e78 main + 12248
21 libdyld.dylib            0x00007fff544b6115 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/Objects-normal/x86_64/Two~partial.swiftmodule /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/Objects-normal/x86_64/One~partial.swiftmodule -parse-as-library -target x86_64-apple-ios11.2 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk -I /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Products/Debug-iphonesimulator -F /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Products/Debug-iphonesimulator -enable-testing -g -import-underlying-module -module-cache-path /Users/kevin/Library/Developer/Xcode/DerivedData/ModuleCache -swift-version 4 -enforce-exclusivity=checked -D DEBUG -serialize-debugging-options -report-errors-to-debugger -Xcc -I/Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/CrashTest-generated-files.hmap -Xcc -I/Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/CrashTest-own-target-headers.hmap -Xcc -I/Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/CrashTest-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/CrashTest-project-headers.hmap -Xcc -I/Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/DerivedSources/x86_64 -Xcc -I/Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/kevin/Desktop/CrashTest -emit-module-doc-path /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/Objects-normal/x86_64/CrashTest.swiftdoc -module-name CrashTest -emit-objc-header-path /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/Objects-normal/x86_64/CrashTest-Swift.h -o /Users/kevin/Library/Developer/Xcode/DerivedData/CrashTest-aednlmfdnpuqmgcvxjgxdsevfwiu/Build/Intermediates.noindex/CrashTest.build/Debug-iphonesimulator/CrashTest.build/Objects-normal/x86_64/CrashTest.swiftmodule 
1.  While loading conformances for 'Two' in module 'CrashTest'
2.  While reading inherited conformance for type 'Two'
3.  While cross-referencing conformance for 'One' in module 'CrashTest'
@lilyball
Copy link
Mannequin Author

lilyball mannequin commented Dec 27, 2017

I just came up with a really tiny reproduction case. I'm going to replace the attachment and description.

@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 serialization Area → compiler: Serialization & deserialization
Projects
None yet
Development

No branches or pull requests

1 participant