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-8033] Crash on simple conditional conformance #50566

Closed
AnthonyLatsis opened this issue Jun 18, 2018 · 5 comments
Closed

[SR-8033] Crash on simple conditional conformance #50566

AnthonyLatsis opened this issue Jun 18, 2018 · 5 comments
Assignees
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

Comments

@AnthonyLatsis
Copy link
Collaborator

Previous ID SR-8033
Radar None
Original Reporter @AnthonyLatsis
Type Bug
Status Resolved
Resolution Done
Environment

Version 10.0 beta (10L176w)

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

md5: 4cc667050d3ae0782752a55479bd4def

Issue Description:

Quite unexpected.

struct Foo<T> {}

protocol P1 {associatedtype A}
extension Foo: P1 where A : P1 {}
@swift-ci
Copy link
Collaborator

Comment by John Lin (JIRA)

Looks like a type checker bug

 $ swiftc -typecheck bug.swift
 0 swift 0x000000010df8ec5a PrintStackTraceSignalHandler(void*) + 42
 1 swift 0x000000010df8e066 SignalHandler(int) + 966
 2 libsystem_platform.dylib 0x00007fff64be3f5a _sigtramp + 26
 3 swift 0x000000010b41bba4 swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*) + 148
 4 swift 0x000000010b65b8f0 swift::ASTContext::getConformance(swift::Type, swift::ProtocolDecl*, swift::SourceLoc, swift::DeclContext*, swift::ProtocolConformanceState) + 656
 5 swift 0x000000010b6f751f swift::ConformanceLookupTable::getConformance(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceEntry*) + 1199
 6 swift 0x000000010b78e69c swift::NominalTypeDecl::lookupConformance(swift::ModuleDecl*, swift::ProtocolDecl*, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) const + 684
 7 swift 0x000000010b76ebd4 swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*) + 1892
 8 swift 0x000000010a3e01c7 llvm::Optional<swift::ProtocolConformanceRef> llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>::callback_fn<swift::LookUpConformanceInModule>(long, swift::CanType, swift::Type, swift::ProtocolType*) + 183
 9 swift 0x000000010b72d247 bool llvm::function_ref<bool (swift::Type, llvm::ArrayRef<swift::Requirement>)>::callback_fn<swift::GenericSignature::getSubstitutionMap(llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>) const::$_6>(long, swift::Type, llvm::ArrayRef<swift::Requirement>) + 423
 10 swift 0x000000010b72c2ad swift::GenericSignature::enumeratePairedRequirements(llvm::function_ref<bool (swift::Type, llvm::ArrayRef<swift::Requirement>)>) const + 1405
 11 swift 0x000000010b7a3fd0 swift::TypeBase::getContextSubstitutionMap(swift::ModuleDecl*, swift::DeclContext const*, swift::GenericEnvironment*) + 352
 12 swift 0x000000010b41c525 swift::TypeChecker::substMemberTypeWithBase(swift::ModuleDecl*, swift::TypeDecl*, swift::Type) + 773
 13 swift 0x000000010b41c1e4 swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*) + 1748
 14 swift 0x000000010b42909f resolveTypeDecl(swift::TypeChecker&, swift::TypeDecl*, swift::SourceLoc, swift::DeclContext*, swift::DeclContext*, swift::GenericIdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 191
 15 swift 0x000000010b42654d resolveTopLevelIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, swift::ComponentIdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 109
 16 swift 0x000000010b4270f7 resolveTopLevelIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, swift::ComponentIdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 3095
 17 swift 0x000000010b4260d5 resolveIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, llvm::ArrayRef<swift::ComponentIdentTypeRepr*>, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 485
 18 swift 0x000000010b422c3a swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 122
 19 swift 0x000000010b41e248 (anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>) + 152
 20 swift 0x000000010b41e169 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 233
 21 swift 0x000000010b41d365 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 213
 22 swift 0x000000010b3b36f8 swift::TypeChecker::validateRequirement(swift::SourceLoc, swift::RequirementRepr&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 120
 23 swift 0x000000010b3b35d6 swift::TypeChecker::checkGenericParamList(swift::GenericSignatureBuilder*, swift::GenericParamList*, swift::GenericSignature*, swift::GenericTypeResolver*) + 534
 24 swift 0x000000010b3b945d swift::TypeChecker::checkGenericEnvironment(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, bool, swift::ExtensionDecl*, llvm::function_ref<void (swift::GenericSignatureBuilder&)>, bool) + 1421
 25 swift 0x000000010b37c803 swift::TypeChecker::validateExtension(swift::ExtensionDecl*) + 563
 26 swift 0x000000010b397afc (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 332
 27 swift 0x000000010b42f616 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1830
 28 swift 0x000000010b0666de swift::CompilerInstance::performSema() + 4238
 29 swift 0x000000010a2618db performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 731
 30 swift 0x000000010a25e10f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7839
 31 swift 0x000000010a207c48 main + 13144
 32 libdyld.dylib 0x00007fff648d5015 start + 1
 33 libdyld.dylib 0x000000000000000d start + 2607984633
 Stack dump:
 0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -typecheck -primary-file bug.swift -target x86_64-apple-darwin17.6.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -color-diagnostics -module-name bug 
 1. While type-checking extension of Foo at bug.swift:4:1
 2. While resolving type A at [bug.swift:4:25 - line:4:25] RangeText="A"
 [1] 72097 segmentation fault swiftc -typecheck bug.swift

@AnthonyLatsis
Copy link
Collaborator Author

Yes, related to https://bugs.swift.org/browse/SR-7987 and https://bugs.swift.org/browse/SR-6569.
johnlinvc (JIRA User) Could you put the stack trace into a code block?

@belkadan
Copy link
Contributor

@huonw, did you already have one of these?

@AnthonyLatsis
Copy link
Collaborator Author

#17356

@huonw
Copy link
Mannequin

huonw mannequin commented Jun 21, 2018

#17356

(Thanks Anthony for taking a look!)

@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
Projects
None yet
Development

No branches or pull requests

3 participants