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-1924] locally defined class after return crashes compiler #44533

Closed
mattneub opened this issue Jun 28, 2016 · 3 comments
Closed

[SR-1924] locally defined class after return crashes compiler #44533

mattneub opened this issue Jun 28, 2016 · 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

@mattneub
Copy link

Previous ID SR-1924
Radar None
Original Reporter @mattneub
Type Bug
Status Resolved
Resolution Done
Environment

Xcode Version 8.0 beta (8S128d) and its version of Swift 3

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

md5: 1a0dc260ae3d2d9a42ce72bd4313424b

Issue Description:

This code crashes the compiler with a segfault:

    func test() {
        return;
        class A {
            
        }
    }

Neither the return; nor the locally defined class A is illegal. It's the combination of the two that's the problem: defining a class locally, at any depth, after a return seems to elicit the crash.

@slavapestov
Copy link
Member

The AST is valid, however SILGen erroneously skips emitting the class because it thinks it's "code" that is unreachable.

@slavapestov
Copy link
Member

Actually, since name lookup can't see the class in this case, it would be more correct to drop it altogether.

@slavapestov
Copy link
Member

#6543

@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