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-4387] Compiler Segmentation Fault 11 on wrongly ordered lets #46966

Closed
swift-ci opened this issue Mar 28, 2017 · 3 comments
Closed

[SR-4387] Compiler Segmentation Fault 11 on wrongly ordered lets #46966

swift-ci opened this issue Mar 28, 2017 · 3 comments
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-4387
Radar rdar://problem/30651948
Original Reporter terhechte (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 8.3 (8E162)

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

md5: d754771c7b5813fa4dc2d21ac442df68

is duplicated by:

  • SR-4688 Compiler crash using variable before its declaration
  • SR-4840 Segmentation fault because of weird order of variables
  • SR-5840 Compiler crash
  • SR-6099 Segmentation Fault 11, emanating from SIL generation
  • SR-6121 Internal error on shadowing let in a guard
  • SR-4918 Compiler crash related to Optionals

relates to:

  • SR-4082 Compiler Crash on multi-statement if with shadowed variable

Issue Description:

Hey,

these couple of lines of invalid code result in a segfault instead of the expected compiler error:

struct Person {
    let name: String?
}

struct Company {
    let owner: Person?
}

func test() {
    let example: Company? = Company(owner: Person(name: "Owner"))
    if let person = aCompany.owner,
        let aCompany = example {
        print("\(person)")
    }
}

The error is that aCompany is happening after let person = aCompany.owner that would provide it. Instead of pointing out to the user, that the variable `aCompany` doesn't exist, the compiler crashes.

@belkadan
Copy link
Contributor

The assertion failure for this is the same verifier error

Assertion failed: ((HadError || !M.is<SourceFile*>() || M.get<SourceFile*>()->ASTStage < SourceFile::TypeChecked) && "UnresolvedDot" "in wrong phase"), function walkToExprPre, file /Volumes/Data/swift-public/swift/include/swift/AST/ExprNodes.def, line 87.

we've seen in some of @dabrahams' bugs. @rudkx, is this any help?

@belkadan
Copy link
Contributor

belkadan commented Sep 5, 2017

@swift-ci create

@gregomni
Copy link
Collaborator

gregomni commented Oct 14, 2017

Fixed in #12438.

The result now is as you'd expect: "error: use of unresolved identifier 'aCompany'"

@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