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-2824] Assertion failure: "can't load extension members before base has finished" #45428

Closed
swift-ci opened this issue Oct 3, 2016 · 4 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 serialization Area → compiler: Serialization & deserialization

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 3, 2016

Previous ID SR-2824
Radar rdar://problem/35308657
Original Reporter Math- (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS Sierra,
Swift 3.0,

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

md5: 4aa11d1327494ef0d1e9c019db2a567f

Issue Description:

Hello all,

I have a reproducible ICE with these few lines of code :

import Foundation

extension NSObject {
    func observe(_ name: Notification.Name, _ selector: Selector) { }
}
func notify(_ name: Notification.Name) { }

Changing Notification.Name to NSNotification.Name in either one (or both) of the params prevents the compiler from crashing.

Stacktrace is attached in stack.log

That's with :

$ swift --version
Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
Target: x86_64-apple-macosx10.9

Let me know if you need anything more.

@belkadan
Copy link
Contributor

belkadan commented Oct 3, 2016

Pretty silly circularity here: Notification.Name -> NSNotification.Name -> NSNotification -> NSObject -> observe(_:_:) -> Notification.Name. Clearly one or more of those links shouldn't be necessary.

@slavapestov
Copy link
Member

Still crashes.

Assertion failed: ((clangContainer->decls_empty() || !base->getMembers().empty()) && "can't load extension members before base has finished"), function loadMembersOfBaseImportedFromClang, file /Users/slava/new/swift/lib/ClangImporter/ImportDecl.cpp, line 8134.
0  swift                    0x000000010f6ddd28 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010f6de3e6 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fff5e914f5a _sigtramp + 26
3  libsystem_platform.dylib 0x00007ffee3b96130 _sigtramp + 2233995760
4  libsystem_c.dylib        0x00007fff5e74032a abort + 127
5  libsystem_c.dylib        0x00007fff5e708380 basename_r + 0
6  swift                    0x000000010cff4f76 swift::ClangImporter::Implementation::loadAllMembersOfObjcContainer(swift::Decl*, clang::ObjCContainerDecl const*) + 326
7  swift                    0x000000010cff4dbe swift::ClangImporter::Implementation::loadAllMembers(swift::Decl*, unsigned long long) + 462

@slavapestov
Copy link
Member

@swift-ci create

@belkadan
Copy link
Contributor

Looks like this got fixed along the way for Swift 4.1.

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

No branches or pull requests

4 participants