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-7633] Compiler crash (Segmentation Fault 11) when assigning protocol method to variable #50174

Closed
robinkunde opened this issue May 8, 2018 · 4 comments
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 regression swift 4.0

Comments

@robinkunde
Copy link
Contributor

Previous ID SR-7633
Radar rdar://problem/40059784
Original Reporter @robinkunde
Type Bug
Status Resolved
Resolution Duplicate
Environment

Swift 4.1, 4.1.1 beta, and master (8eb34ab) are affected

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.0Regression, CompilerCrash
Assignee None
Priority Medium

md5: f7bfb414117b83abe2c2c5185b83128c

duplicates:

  • SR-75 Referencing a protocol function crashes the compiler

Issue Description:

The following code will currently crash the compiler:

protocol OhNo {
    func whoops()
}
let crash = OhNo.whoops

Output from releaseAssert build:

not existential
UNREACHABLE executed at /Users/rkunde/private_git/swift_source/swift/lib/SILGen/SILGenConvert.cpp:932!
0 swift 0x0000000111147f58 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000001111485e6 SignalHandler(int) + 422
2 libsystem_platform.dylib 0x00007fff72d6cf5a _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2368286912
4 libsystem_c.dylib 0x00007fff72b0a1ae abort + 127
5 swift 0x00000001110e1ef0 LLVMInstallFatalErrorHandler + 0
6 swift 0x000000010df1b897 swift::Lowering::SILGenFunction::emitOpenExistential(swift::SILLocation, swift::Lowering::ManagedValue, swift::ArchetypeType*, swift::SILType, swift::AccessKind) + 823
7 swift 0x000000010df3fd1e swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 478
8 swift 0x000000010df4f9f1 swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_15>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_15) + 65
9 swift 0x000000010df45f08 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 19384
10 swift 0x000000010df310cf swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 319
11 swift 0x000000010df209e4 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 292
12 swift 0x000000010df20c2d swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
13 swift 0x000000010ded52b9 swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 313
14 swift 0x000000010ded5afb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 827
15 swift 0x000000010ded6860 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 352
16 swift 0x000000010ded6e6f swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>) + 95
17 swift 0x000000010d7667cd performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8621
18 swift 0x000000010d763616 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3318
19 swift 0x000000010d72026d main + 2317
20 libdyld.dylib 0x00007fff72a5e015 start + 1
Stack dump:
0.  Program arguments: /Users/rkunde/private_git/swift_source/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file /Users/rkunde/crash.swift -target x86_64-apple-darwin17.5.0 -enable-objc-interop -color-diagnostics -module-name crash -o /var/folders/hd/862mpr452tzd7_hz00mfmk6c0000gn/T/crash-4eb0ee.o
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
@belkadan
Copy link
Contributor

belkadan commented May 8, 2018

Also affects 4.0. It looks like we used to have an error for this but it's not firing now.

@swift-ci create

@belkadan
Copy link
Contributor

belkadan commented May 8, 2018

(The error was just "you can't do this [because it's not implemented]" but that's better than crashing.)

@slavapestov
Copy link
Member

We never had an error for this.

@swift-ci
Copy link
Collaborator

Comment by Luke Street (JIRA)

Any updates on this? Would love this kind of functionality.

@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 regression swift 4.0
Projects
None yet
Development

No branches or pull requests

5 participants