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-12238] Segmentation Fault: 11 when conforming to protocol using a same generic and associated type names and a protocol extension. #54665

Closed
swift-ci opened this issue Feb 20, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12238
Radar rdar://problem/59655519
Original Reporter roydaw (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-darwin19.0.0

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

md5: 4a03125747c8972dcffe32743e88044d

duplicates:

  • SR-8814 GenericSignatureBuilder should re-introduce conformance requirements when adding a superclass requirement

Issue Description:

Most of the elements in the example code are necessary to reproduce the bug. If the name of the associatedtype or generic type `T` is changed then the code does not compile but has not segmentation fault. If `func foo()` is implemented in `Class`, then the code compiles.

public protocol Protocol {
    associatedtype T : Codable
    
    func foo()
}

public extension Protocol {
    func foo() {}
}

class Class<T>: Protocol where T : Codable {

}
Stack dump:
 0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret main.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main 
 1. While emitting IR SIL function "@$s4main5ClassCyqd__GAA8ProtocolA2aEP3fooyyFTW".
 for 'foo()' (at main.swift:8:5)
 0 swift 0x000000010dc64a63 PrintStackTraceSignalHandler(void*) + 51
 1 swift 0x000000010dc64236 SignalHandler(int) + 358
 2 libsystem_platform.dylib 0x00007fff71918b1d _sigtramp + 29
 3 libsystem_platform.dylib 0x00007fcc2cd02340 _sigtramp + 3141441600
 4 swift 0x000000010991b9b1 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>*) + 65
 5 swift 0x000000010991b922 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 450
 6 swift 0x000000010991b728 void llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>::callback_fn<swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&)::$_1>(long, unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>) + 1656
 7 swift 0x0000000109a7c71f swift::irgen::GenericTypeRequirements::enumerateFulfillments(swift::irgen::IRGenModule&, swift::SubstitutionMap, llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>) + 335
 8 swift 0x000000010991a8ee swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 478
 9 swift 0x000000010991a6d0 swift::irgen::FulfillmentMap::searchTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::irgen::IsExact_t, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 912
 10 swift 0x0000000109b2ec9d swift::irgen::IRGenFunction::bindLocalTypeDataFromTypeMetadata(swift::CanType, swift::irgen::IsExact_t, llvm::Value*, swift::MetadataState) + 317
 11 swift 0x0000000109a7a674 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 596
 12 swift 0x0000000109ae5cf5 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 6293
 13 swift 0x00000001099949e7 swift::irgen::IRGenerator::emitLazyDefinitions() + 9303
 14 swift 0x0000000109ac38e0 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::_1::unique_ptr<swift::SILModule, std::_1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1344
 15 swift 0x0000000109ac0fe9 swift::performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::_1::unique_ptr<swift::SILModule, std::1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, llvm::ArrayRef<std::1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> > >, llvm::GlobalVariable**) + 825
 16 swift 0x00000001098aeaef performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 37039
 17 swift 0x00000001098a2234 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
 18 swift 0x000000010982f733 main + 1219
 19 libdyld.dylib 0x00007fff717172a5 start + 1
 20 libdyld.dylib 0x000000000000000a start + 2391706982
 zsh: segmentation fault swift main.swift
@hborla
Copy link
Member

hborla commented Feb 21, 2020

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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.
Projects
None yet
Development

No branches or pull requests

2 participants