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-10462] LLDB Segmentation fault #4574

Closed
swift-ci opened this issue Apr 12, 2019 · 5 comments
Closed

[SR-10462] LLDB Segmentation fault #4574

swift-ci opened this issue Apr 12, 2019 · 5 comments
Labels
bug Something isn't working Compiler LLDB for Swift

Comments

@swift-ci
Copy link

Previous ID SR-10462
Radar None
Original Reporter MilosBabic (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

:version

lldb-1001.0.12.1

Swift-5.0

MacOS: 10.14.3

Additional Detail from JIRA
Votes 0
Component/s Compiler, LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: 3347b3b7a9ca5236e7e26fc8d450926d

duplicates:

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

Issue Description:

The code works if we replace class ClassB with struct ClassB, or when we implement methodB() in ClassB. Any other way it crashes.

Can be reproduced in XCode10.2 or in REPL.

protocol ProtocolB {               
    associatedtype BType: Hashable               
    func methodB()
}
extension ProtocolB {
    func methodB() {}
}
class ClassB<T: Hashable>: ProtocolB {         
    typealias BType = T 
}

Hashable protocol is just an example, any other protocol also causes this, custom or otherwise.

Running this will crash with stacktrace :

0 lldb 0x000000010a32ef95 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37

1 lldb 0x000000010a32e347 llvm::sys::RunSignalHandlers() + 39

2 lldb 0x000000010a32f5f2 SignalHandler(int) + 258

3 libsystem_platform.dylib 0x00007fff78b96b3d _sigtramp + 29

4 libsystem_platform.dylib 0x00007fa36c8e42a8 _sigtramp + 4090812296

5 LLDB 0x0000000111c5963d swift::Lowering::TypeConverter::getProtocolDispatchStrategy(swift::ProtocolDecl*) + 13

6 LLDB 0x0000000111a6b0db swift::irgen::TypeConverter::getProtocolInfo(swift::ProtocolDecl*, swift::irgen::ProtocolInfoKind) + 219

7 LLDB 0x0000000111a6aff0 swift::irgen::IRGenModule::getProtocolInfo(swift::ProtocolDecl*, swift::irgen::ProtocolInfoKind) + 16

8 LLDB 0x00000001119b338d 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*>*) + 61

9 LLDB 0x00000001119b32f1 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 465

10 LLDB 0x00000001119b40f1 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>) + 1553

11 LLDB 0x0000000111a6f0ef swift::irgen::GenericTypeRequirements::enumerateFulfillments(swift::irgen::IRGenModule&, swift::SubstitutionMap, llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>) + 255

12 LLDB 0x00000001119b2ddc swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 236

13 LLDB 0x00000001119b2cba 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&) + 746

14 LLDB 0x0000000111aeede5 swift::irgen::LocalTypeDataCache::addAbstractForTypeMetadata(swift::irgen::IRGenFunction&, swift::CanType, swift::irgen::IsExact_t, swift::irgen::MetadataResponse) + 85

15 LLDB 0x0000000111aeed70 swift::irgen::IRGenFunction::bindLocalTypeDataFromTypeMetadata(swift::CanType, swift::irgen::IsExact_t, llvm::Value*, swift::MetadataState) + 256

16 LLDB 0x0000000111a6dd96 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 678

17 LLDB 0x0000000111abf1b4 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 4596

18 LLDB 0x00000001119ee737 swift::irgen::IRGenerator::emitLazyDefinitions() + 567

19 LLDB 0x0000000111aa07bf 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**) + 1199

20 LLDB 0x0000000111a9f5f6 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**) + 1398

21 LLDB 0x00000001126ab22a lldb_private::SwiftExpressionParser::Parse(lldb_private::DiagnosticManager&, unsigned int, unsigned int, unsigned int) + 7506

22 LLDB 0x00000001126f52f7 lldb_private::SwiftUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool, unsigned int) + 911

23 LLDB 0x000000011249066f lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::Status&, unsigned int, std::_*1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::*_1::shared_ptr<lldb_private::Module>) + 1361

24 LLDB 0x0000000112350bbd lldb_private::REPL::IOHandlerInputComplete(lldb_private::IOHandler&, std::_1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> >&) + 1863

25 LLDB 0x00000001123e267e lldb_private::IOHandlerEditline::Run() + 338

26 LLDB 0x00000001122ad168 lldb_private::Debugger::ExecuteIOHandlers() + 68

27 LLDB 0x00000001122afde8 lldb_private::Debugger::IOHandlerThread(void*) + 14

28 LLDB 0x00000001124ee91b lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105

29 libsystem_pthread.dylib 0x00007fff78b9f305 _pthread_body + 126

30 libsystem_pthread.dylib 0x00007fff78ba226f _pthread_start + 70

31 libsystem_pthread.dylib 0x00007fff78b9e415 thread_start + 13

[1] 13746 segmentation fault swift

@belkadan
Copy link

@adrian-prantl, @slavapestov, does this look familiar?

@slavapestov
Copy link
Member

Looks like https://bugs.swift.org/browse/SR-8814.

@adrian-prantl
Copy link
Member

I have not seen this backtrace before, but from the looks of it this seems to be a plain old compiler bug?

@slavapestov
Copy link
Member

Yeah, I'm pretty sure its a GSB bug and not lldb related. I'll dupe it after I confirm.

@dcci
Copy link
Mannequin

dcci mannequin commented Oct 29, 2019

This still reproduces:

  1> protocol ProtocolB {
  2.     associatedtype BType: Hashable
  3.     func methodB()
  4. }
  5. extension ProtocolB {
  6.     func methodB() {}
  7. }
  8. class ClassB<T: Hashable>: ProtocolB {
  9.     typealias BType = T
 10. }
lldb: /Users/docker_user/src/llvm/include/llvm/ADT/PointerUnion.h:202: T llvm::PointerUnion<swift::ProtocolDecl *, swift::ProtocolConformance *>::get() const [PTs = <swift::ProtocolDecl *, swift::ProtocolConformance *>, T = swift::ProtocolConformance *]: Assertion `is<T>() && "Invalid accessor called"' failed.
Aborted

@slavapestov I agree with you, this seems to me a compiler bug.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 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 Something isn't working Compiler LLDB for Swift
Projects
None yet
Development

No branches or pull requests

4 participants