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-4957] Compiler crash in "computeNominalType" for nested type named "Iterator" in generic outer type #47534

Closed
swift-ci opened this issue May 21, 2017 · 4 comments
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 regression serialization Area → compiler: Serialization & deserialization swift 4.0

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-4957
Radar rdar://problem/32328702
Original Reporter Jnosh (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

macOS 10.12.5
Xcode 8.3.2
Apple Swift version 4.0-dev (LLVM 99f1de85be, Clang 81c3e9a66e, Swift 4ebd716)

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

md5: c2f13aae5e9a0de26f9b4211b40e36d7

Issue Description:

I encountered this crash with the swift-DEVELOPMENT-SNAPSHOT-2017-05-19-a toolchain downloaded from swift.org. The issue was/is not present with the swift-DEVELOPMENT-SNAPSHOT-2017-05-10-a toolchain.

swiftc crashes in computeNominalType for the following reduced example:

Generic.swift:

struct Generic<Element> {}

extension Generic {
    struct Iterator {}
}

main.swift:

// This file intentionally left blank

Compile command that leads to crash:
swiftc Sequence.swift main.swift

Changing almost anything else will make the crash disappear (including removing main.swift).
Potentially helpful: Renaming Iterator (to for example _Iterator) will stop the crasher.


Full stacktrace:

0 swift 0x000000010c7f2b88 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010c7f1b56 llvm::sys::RunSignalHandlers() + 86
2 swift 0x000000010c7f3149 SignalHandler(int) + 361
3 libsystem_platform.dylib 0x00007fffd32a1b3a _sigtramp + 26
4 libsystem_platform.dylib 0x00007fff5665ccd0 _sigtramp + 2201727408
5 swift 0x000000010a5a69ce computeNominalType(swift::NominalTypeDecl*, DeclTypeKind) + 238
6 swift 0x000000010a5a68cf swift::NominalTypeDecl::getDeclaredType() const + 31
7 swift 0x000000010a53f3a4 swift::Mangle::ASTMangler::appendAnyGenericType(swift::GenericTypeDecl const*) + 84
8 swift 0x000000010a53f336 swift::Mangle::ASTMangler::mangleNominalType(swift::NominalTypeDecl const*) + 38
9 swift 0x000000010a1e884c swift::ModuleFile::loadExtensions(swift::NominalTypeDecl*) + 1036
10 swift 0x000000010a23ebf1 swift::SerializedModuleLoader::loadExtensions(swift::NominalTypeDecl*, unsigned int) + 49
11 swift 0x000000010a4ff86f swift::ASTContext::loadExtensions(swift::NominalTypeDecl*, unsigned int) + 63
12 swift 0x000000010a5961bc swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 2012
13 swift 0x000000010a595b07 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 295
14 swift 0x000000010a595f4b swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 1387
15 swift 0x000000010a599611 swift::ConformanceLookupTable::getAllProtocols(swift::NominalTypeDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolDecl*>&) + 33
16 swift 0x000000010a62139b swift::NominalTypeDecl::getAllProtocols() const + 107
17 swift 0x0000000109d76d71 (anonymous namespace)::NominalTypeWalker::walkToDeclPre(swift::Decl*) + 65
18 swift 0x000000010a57af6c (anonymous namespace)::Traversal::doIt(swift::Decl*) + 204
19 swift 0x000000010a57b17a (anonymous namespace)::Traversal::doIt(swift::Decl*) + 730
20 swift 0x000000010a57ae8b swift::Decl::walk(swift::ASTWalker&) + 27
21 swift 0x0000000109d766bb swift::ClassHierarchyAnalysis::init() + 139
22 swift 0x0000000109d69bb9 swift::createClassHierarchyAnalysis(swift::SILModule*) + 153
23 swift 0x0000000109e35e0c swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 460
24 swift 0x0000000109e41897 swift::runSILDiagnosticPasses(swift::SILModule&) + 135
25 swift 0x00000001095e9f3b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8283
26 swift 0x00000001095e6e0a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2650
27 swift 0x00000001095a3420 main + 3312
28 libdyld.dylib 0x00007fffd3092235 start + 1
29 libdyld.dylib 0x000000000000003b start + 754376199

@belkadan
Copy link
Contributor

Thank you for the excellently-reduced reproducer!

@swift-ci create

@belkadan
Copy link
Contributor

@slavapestov, possible fallout from using the nested type map everywhere, unfortunately.

@slavapestov
Copy link
Member

#9843

@swift-ci
Copy link
Collaborator Author

Comment by Janosch Hildebrand (JIRA)

Closing an old, resolved issue.

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

No branches or pull requests

4 participants