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-7261] Compiler crash on switch case with let and var value bindings #49809

Closed
swift-ci opened this issue Mar 23, 2018 · 5 comments
Closed
Assignees
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

Previous ID SR-7261
Radar rdar://problem/38800528
Original Reporter damonallison (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

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

md5: d470f571f5745a3d9eab407d950e70d3

Issue Description:

The following code, with `let` and `var` value bindings in the same case causes the swift compiler to `SIGSEGV`.

allidam@chritmaclt5 ~/p/swift-fundamentals> swift
Welcome to Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2). Type :help for assistance.
1> func test() {
2. let name = "test"
3. switch name {
4. case var n where n.count == 10, let n where n == "test":
5. break
6. default:
7. break
8. }
9. }
Stack dump:
0.  While emitting SIL for 'test()' at /var/folders/29/52nb4xys2pxfxhcz8m26xnsc94m_nc/T/repl1-1a96fe..swift:1:1
fish: 'swift' terminated by signal SIGSEGV (Address boundary error)
@belkadan
Copy link
Contributor

cc @gregomni

@swift-ci create

@belkadan
Copy link
Contributor

With asserts:

Assertion failed: (address.isLValue() && "physical lvalue decl ref must evaluate to an address"), function emitLValueForNonMemberVarDecl, file /Volumes/Data/swift-public/swift/lib/SILGen/SILGenLValue.cpp, line 2276.

@gregomni
Copy link
Collaborator

Done in #15488

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 26, 2018

damonallison (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?
Thanks!
Anna

@swift-ci
Copy link
Collaborator Author

Comment by Damon Allison (JIRA)

Confirmed fixed. Nice work and thank you, @gregomni!

/Users/dra/projects/swift-fundamentals/SwiftFundamentals-Tests/CompilerBugs/SR7874.swift:17:41: error: 'let' pattern binding must match previous 'var' pattern binding
    case var n where n.count == 10, let n:
                                    ~~~ ^
                                    var

@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

4 participants