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-7207] Assertion failure in getOrCreateKeyPathEqualsAndHash #49755

Open
swift-ci opened this issue Mar 15, 2018 · 5 comments
Open

[SR-7207] Assertion failure in getOrCreateKeyPathEqualsAndHash #49755

swift-ci opened this issue Mar 15, 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 key paths Feature: key paths (both native and Objective-C)

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-7207
Radar rdar://problem/38506058
Original Reporter kdawgwilk (JIRA User)
Type Bug
Environment

macOS 10.13.3

Xcode 9.3b4

Old build system

Toolchain 3/14/18 (master)

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

md5: a35fb9cdb2f5fd89b5326237d000d7d1

Issue Description:

Ran into this when trying to help test the new batch mode. The assertion occurred when compiling the Differentiator library we depend on

Assertion failed: (hasVal), function operator*, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/include/llvm/ADT/Optional.h, line 160.
0  swift                    0x000000010650c678 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010650cd86 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fff5c149f5a _sigtramp + 26
3  libsystem_platform.dylib 0x00000001181b0578 _sigtramp + 3154535992
4  libsystem_c.dylib        0x00007fff5bf74312 abort + 127
5  libsystem_c.dylib        0x00007fff5bf3c368 basename_r + 0
6  swift                    0x00000001034f7877 getOrCreateKeyPathEqualsAndHash(swift::Lowering::SILGenModule&, swift::SILLocation, swift::GenericEnvironment*, llvm::ArrayRef<swift::KeyPathPatternComponent::Index>, swift::SILFunction*&, swift::SILFunction*&) + 12391
7  swift                    0x00000001034f2c25 swift::Lowering::SILGenModule::emitKeyPathComponentForDecl(swift::SILLocation, swift::GenericEnvironment*, unsigned int&, bool&, llvm::ArrayRef<swift::Substitution>, swift::AbstractStorageDecl*, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::CanType) + 1429
8  swift                    0x000000010348d2ec swift::Lowering::SILGenModule::tryEmitPropertyDescriptor(swift::AbstractStorageDecl*) + 1004
9  swift                    0x00000001035631ab SILGenExtension::emitExtension(swift::ExtensionDecl*) + 59
10 swift                    0x0000000103563165 swift::Lowering::SILGenModule::visitExtensionDecl(swift::ExtensionDecl*) + 21
11 swift                    0x000000010348dd3b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 811
12 swift                    0x000000010348eaf0 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 352
13 swift                    0x000000010348f0df swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>) + 95
14 swift                    0x0000000102d7c146 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8598
15 swift                    0x0000000102d78f9e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3310
16 swift                    0x0000000102d2faf3 main + 2051
17 libdyld.dylib            0x00007fff5bec8115 start + 1
Stack dump:
0.
@jckarter
Copy link
Member

@swift-ci create

@jckarter
Copy link
Member

kdawgwilk (JIRA User) Can you give me more detailed instructions on how to reproduce? I checked out the RxDataSources repo from https://github.com/RxSwiftCommunity/RxDataSources.git, and built with xcodebuild -target Differentiator SWIFT_EXEC=`which swiftc` ENABLE_BITCODE=NO, and did not see the assertion failure.

@jckarter
Copy link
Member

I'm using the master branch of Swift from today, 3/16, which is only a couple days newer than yours, for reference.

@slavapestov
Copy link
Member

@jckarter I suspect the problem is the lookupConformance() call here:

      // Get the Equatable conformance from the Hashable conformance
      auto subMap = hashableSig->getSubstitutionMap(
        Substitution(formalTy, hashable));
      auto equatable = *subMap
        .lookupConformance(CanType(hashableSig->getGenericParams()[0]),
                           equatableProtocol);

Since we don't have a type checker anymore, if nothing previously forced the conformance, it will return an empty Optional and crash.

@jckarter
Copy link
Member

Thanks Slava. If that's the case, this will hopefully fix it: #15459

@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
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 key paths Feature: key paths (both native and Objective-C)
Projects
None yet
Development

No branches or pull requests

4 participants