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-9846] Crash when using indirect enum with closure case #52257

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

[SR-9846] Crash when using indirect enum with closure case #52257

swift-ci opened this issue Feb 2, 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

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Feb 2, 2019

Previous ID SR-9846
Radar None
Original Reporter luiz (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

macOS Mojave 10.14.2 (18C54)
Xcode 10.2 beta (10P82s)

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

md5: d1c0266599fe3ab5c2436add6a1b535c

Issue Description:

The following snippet crashes during SILGen in Xcode 10.2 beta:

public indirect enum Foo {
    case closure(executing: () -> ())
}

func bar() {
    Foo.closure { }
}

Weirdly enough, if we either remove the unneeded 'indirect' keyword, or reference the case as:

Foo.closure(executing: { })

it no longer crashes.

Crash log:

Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file Test.swift -target x86_64-apple-darwin18.2.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -color-diagnostics -module-name Test -o /var/folders/nt/whnbw2bj0hzd_brpp782s3300000gn/T/Test-bb348f.o 
1.  While emitting SIL for 'bar()' (at Test.swift:5:1)
2.  While silgen emitFunction SIL function "@$s4Test3baryyF".
 for 'bar()' (at Test.swift:5:1)
0  swift                    0x00000001129b1f8a PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x00000001129b177c SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff6c50ab3d _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2477741280
4  swift                    0x000000010f78fc13 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
5  swift                    0x000000010f707d21 swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && + 513
6  swift                    0x000000010f734899 swift::Lowering::SILGenFunction::emitInjectEnum(swift::SILLocation, swift::Lowering::ArgumentSource, swift::SILType, swift::EnumElementDecl*, swift::Lowering::SGFContext) + 2633
7  swift                    0x000000010f73aae8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 6024
8  swift                    0x000000010f735f3b swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 2235
9  swift                    0x000000010f7a842b swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 811
10 swift                    0x000000010f805443 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 10403
11 swift                    0x000000010f7bc41b swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 427
12 swift                    0x000000010f71b4ce swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 1006
13 swift                    0x000000010f725916 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1206
14 swift                    0x000000010f7275e5 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1253
15 swift                    0x000000010ece3130 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 26896
16 swift                    0x000000010ecd940f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6351
17 swift                    0x000000010ec7aadb main + 1243
18 libdyld.dylib            0x00007fff6c31fed9 start + 1
19 libdyld.dylib            0x000000000000000f start + 2479751479
@belkadan
Copy link
Contributor

belkadan commented Feb 4, 2019

@slavapestov, @jckarter, we fixed this already, right? Though I'm not sure if the fix made it into the 5.0 branch.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Mar 9, 2019

Comment by Luiz Fernando Silva (JIRA)

Appears to be resolved in Xcode 10.2 beta 4

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

No branches or pull requests

3 participants