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-13000] Refactoring: segfault in AddEquatableContext::getDeclarationContextFromInfo(swift::ide::ResolvedCursorInfo) #55445

Closed
nathawes opened this issue Jun 13, 2020 · 3 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 found by stress tester Flag: An issue found by the SourceKit stress tester refactoring Area → source tooling: refactoring

Comments

@nathawes
Copy link
Collaborator

Previous ID SR-13000
Radar rdar://problem/64316798
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, Crash, FoundByStressTester
Assignee @theblixguy
Priority Medium

md5: 49872dc010efb7196d36ebfaa20ffd06

Issue Description:

Computing the available refactorings on the extension in the invalid code below crashes:

enum Foo {}
typealias Bar = (Any, Any) -> Foo
extension /*invoke here:*/Bar {}

Trace:

Thread 3 Crashed:: Dispatch queue: sourcekit.swift.ConsumeAST
0   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000102d42081 swift::NominalTypeDecl::prepareConformanceTable() const + 17
1   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000102d42525 swift::NominalTypeDecl::getAllProtocols() const + 21
2   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101d6ffcc (anonymous namespace)::AddEquatableContext::getDeclarationContextFromInfo(swift::ide::ResolvedCursorInfo) + 108
3   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101d5f07f (anonymous namespace)::RefactoringActionAddEquatableConformance::isApplicable(swift::ide::ResolvedCursorInfo, swift::DiagnosticEngine&) + 47
4   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101d5eb4a swift::ide::collectAvailableRefactorings(swift::SourceFile*, swift::ide::ResolvedCursorInfo, std::__1::vector<swift::ide::RefactoringKind, std::__1::allocator<swift::ide::RefactoringKind> >&, bool) + 2090
5   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c68fbf collectAvailableRefactoringsOtherThanRename(swift::SourceFile*, swift::ide::ResolvedCursorInfo, std::__1::vector<SourceKit::UIdent, std::__1::allocator<SourceKit::UIdent> >&, swift::ide::DelayedStringRetriever&, swift::ide::DelayedStringRetriever&) + 79
6   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c66f2d passCursorInfoForDecl(swift::SourceFile*, swift::ValueDecl const*, swift::ModuleDecl*, swift::Type, bool, bool, swift::ide::ResolvedCursorInfo, llvm::Optional<unsigned int>, swift::SourceLoc, llvm::ArrayRef<SourceKit::RefactoringInfo>, SourceKit::SwiftLangSupport&, swift::CompilerInvocation const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, llvm::ArrayRef<llvm::IntrusiveRefCntPtr<SourceKit::ImmutableTextSnapshot> >, std::__1::function<void (SourceKit::RequestResult<SourceKit::CursorInfoData> const&)>) + 4685
7   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c64866 resolveCursor(SourceKit::SwiftLangSupport&, llvm::StringRef, unsigned int, unsigned int, bool, llvm::IntrusiveRefCntPtr<SourceKit::SwiftInvocation>, bool, bool, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::function<void (SourceKit::RequestResult<SourceKit::CursorInfoData> const&)>)::CursorInfoConsumer::handlePrimaryAST(llvm::IntrusiveRefCntPtr<SourceKit::ASTUnit>) + 4294
8   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c1caff void SourceKit::WorkQueue::DispatchData::callAndDelete<SourceKit::ASTUnit::Implementation::consumeAsync(std::__1::shared_ptr<SourceKit::SwiftASTConsumer>, llvm::IntrusiveRefCntPtr<SourceKit::ASTUnit>)::$_0>(void*) + 95
9   libdispatch.dylib               0x00007fff6b28c658 _dispatch_client_callout + 8
10  libdispatch.dylib               0x00007fff6b291c44 _dispatch_lane_serial_drain + 597
11  libdispatch.dylib               0x00007fff6b2925d6 _dispatch_lane_invoke + 363
12  libdispatch.dylib               0x00007fff6b29bc09 _dispatch_workloop_worker_thread + 596
13  libsystem_pthread.dylib         0x00007fff6b4e6a3d _pthread_wqthread + 290
14  libsystem_pthread.dylib         0x00007fff6b4e5b77 start_wqthread + 15
@nathawes
Copy link
Collaborator Author

@swift-ci create

@theblixguy
Copy link
Collaborator

#32435

@theblixguy
Copy link
Collaborator

Fixed on master. @nathawes Please verify using next available snapshot!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added refactoring Area → source tooling: refactoring CompilerCrash labels Sep 17, 2022
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Dec 13, 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 found by stress tester Flag: An issue found by the SourceKit stress tester refactoring Area → source tooling: refactoring
Projects
None yet
Development

No branches or pull requests

3 participants