Navigation Menu

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-7115] Nil coalescing inside capture list crashes compiler #49663

Closed
swift-ci opened this issue Mar 4, 2018 · 3 comments
Closed

[SR-7115] Nil coalescing inside capture list crashes compiler #49663

swift-ci opened this issue Mar 4, 2018 · 3 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 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Mar 4, 2018

Previous ID SR-7115
Radar rdar://problem/38144674
Original Reporter arsen (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee arsen (JIRA)
Priority Medium

md5: 7969af05bde14f7c120258c72f8d2acf

Issue Description:

The following code crashes compiler:

var optional: Int?
[1].map { [number = optional ?? 1] value -> String in
    return number.description
}

within a message:

Stack dump:
0. While emitting IR SIL function "@main".
[1] 2759 segmentation fault swift

@hamishknight
Copy link
Collaborator

Interesting, it looks like it's the result of a hack put in that strips autoclosures in the case of accidental double type checking. It accidentally removes the AutoClosureExpr that gets introduced by the call to ?? in the capture list (as capture lists are type checked early) and so breaks the AST.

Not sure what the right solution is here, @benlangmuir do you know if the autoclosure hack is still needed for double type checking?

@belkadan
Copy link
Contributor

belkadan commented Mar 5, 2018

cc @xedin too

@xedin
Copy link
Member

xedin commented Mar 28, 2018

Thanks for the report, arsen (JIRA User)! I've merged PR #15559 to master, the fix should be available in the next nightly snapshot, please verify and resolve.

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

5 participants