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-10492] Paren'd reference to an IUO function crashes compiler #52892

Closed
hamishknight opened this issue Apr 16, 2019 · 5 comments
Closed

[SR-10492] Paren'd reference to an IUO function crashes compiler #52892

hamishknight opened this issue Apr 16, 2019 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@hamishknight
Copy link
Contributor

Previous ID SR-10492
Radar rdar://problem/50169820
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.0-dev (LLVM 94d957ca75, Swift 130cd9e81f)
Target: x86_64-apple-darwin18.5.0

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

md5: 8ee4e902782100dc63e3cfb2c3cdbe6c

Issue Description:

The following hits an unreachable in SILGen:

struct S {
  func foo() -> Int! { return 0 }
}

let s = S()
let x: Int = (s.foo)()

Stack Dump:

We should not see ImplicitlyUnwrappedFunctionConversionExpr here
UNREACHABLE executed at /Users/hamishknight/Desktop/swift-dev/swift/lib/SILGen/SILGenApply.cpp:1232!
Stack dump:
0.  Program arguments: ./swift -frontend -emit-silgen /Users/hamishknight/Desktop/Stochastic Projects/newnew/newnew/main.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
0  swift                    0x0000000111429585 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000111428588 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x0000000111429b88 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff61b98b5d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000000046 _sigtramp + 2655417606
5  libsystem_c.dylib        0x00007fff61a586a6 abort + 127
6  swift                    0x000000011139c53c llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 540
7  swift                    0x000000010d9d484c (anonymous namespace)::SILGenApply::visitImplicitlyUnwrappedFunctionConversionExpr(swift::ImplicitlyUnwrappedFunctionConversionExpr*) + 28
8  swift                    0x000000010d9d4370 swift::ASTVisitor<(anonymous namespace)::SILGenApply, void, void, void, void, void, void>::visit(swift::Expr*) + 7008
9  swift                    0x000000010d9d6932 (anonymous namespace)::SILGenApply::visitApplyExpr(swift::ApplyExpr*) + 2402
10 swift                    0x000000010d9bdfa7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 135
11 swift                    0x000000010da26eef swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 79
12 swift                    0x000000010da18d2f swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 303
13 swift                    0x000000010da07d65 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 325
14 swift                    0x000000010da07e6d swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
15 swift                    0x000000010d9b2f59 swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 505
16 swift                    0x000000010d9b37a6 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 806
17 swift                    0x000000010d9b47a8 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 376
18 swift                    0x000000010d9b4c90 swift::performSILGeneration(swift::ModuleDecl*, swift::SILOptions&) + 16
19 swift                    0x000000010d6bd49a performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 10266
20 swift                    0x000000010d6b9c26 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2982
21 swift                    0x000000010d660af8 main + 696
22 libdyld.dylib            0x00007fff619b33d5 start + 1
fish: './swift -frontend -emit-silgen…' terminated by signal SIGABRT (Abort)
@theblixguy
Copy link
Collaborator

PR here: #26831

@theblixguy
Copy link
Collaborator

Fixed on master. Please verify using next master snapshot and mark the issue as closed. Thank you!

@hamishknight
Copy link
Contributor Author

Reopening for now given the PR was reverted.

@hamishknight
Copy link
Contributor Author

Taking this as it should be fixed by a refactoring of how we deal with IUOs (#39302

@hamishknight
Copy link
Contributor Author

Fixed by the above PR

@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 itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

3 participants