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-10934] Compiler crash involving protocol with opaque return type #53325

Closed
swift-ci opened this issue Jun 15, 2019 · 2 comments
Closed

[SR-10934] Compiler crash involving protocol with opaque return type #53325

swift-ci opened this issue Jun 15, 2019 · 2 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 opaque types Feature → types: opaque types

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10934
Radar rdar://problem/51810110
Original Reporter twof (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

macOS 10.15 Beta (19A471t)
The version of Swift 5.1 that ships with Xcode 11.0 beta (11M336w)

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

md5: fdeb82253a1c6f45b145f4d0b1270c05

Issue Description:

Repro code:

protocol ReturnSome {
    func ret() -> some Numeric
}

Stack dump:

$ swiftc main.swift
Stack dump:
0.  Program arguments: /Users/fnord/Downloads/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file main.swift -target x86_64-apple-darwin19.0.0 -enable-objc-interop -color-diagnostics -module-name main -o /var/folders/hj/q88gsvz5221bdtht4ct6xp8r0000gn/T/main-4d724a.o
1.  While emitting IR for source file main.swift
0  swift                    0x000000010be5f8a3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010be5f076 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff63512b1d _sigtramp + 29
3  libsystem_platform.dylib 0x0000008000000000 _sigtramp + 2628703488
4  swift                    0x0000000107c74bc5 swift::irgen::IRGenModule::emitOpaqueTypeDecl(swift::OpaqueTypeDecl*) + 2613
5  swift                    0x0000000107ba572d swift::irgen::IRGenModule::emitSourceFile(swift::SourceFile&) + 221
6  swift                    0x0000000107ce2073 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**) + 1203
7  swift                    0x0000000107ad3e2a performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 37130
8  swift                    0x0000000107ac7424 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6868
9  swift                    0x0000000107a566b3 main + 1219
10 libdyld.dylib            0x00007fff633127a9 start + 1
11 libdyld.dylib            0x000000000000000d start + 2630801509
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)
@belkadan
Copy link
Contributor

cc @jckarter. I don't think you're allowed to use opaque result types in positions with no body, although it'd be interesting if you got an implicit associated type out of it.

@theblixguy
Copy link
Collaborator

Fixed in Xcode 11 Beta 5:

'some' type cannot be the return type of a protocol requirement; did you mean to add an associated type?

Replace 'func ret() -> some Numeric' with 'associatedtype <#AssocType#>
func ret() -> <#AssocType#>'

@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 opaque types Feature → types: opaque types
Projects
None yet
Development

No branches or pull requests

4 participants