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-14295] super.init allowed in static method #56654

Open
AnthonyLatsis opened this issue Mar 3, 2021 · 2 comments
Open

[SR-14295] super.init allowed in static method #56654

AnthonyLatsis opened this issue Mar 3, 2021 · 2 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 SILGen Area → compiler: The SIL generation stage type checker Area → compiler: Semantic analysis

Comments

@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Mar 3, 2021

Previous ID SR-14295
Radar rdar://problem/75032461
Original Reporter @AnthonyLatsis
Type Bug
Environment

Version 12.4 (12D4e)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 754ea7ec0485c98fcb67ae8d8a3aabd5

Issue Description:

super.init() here is dispatched statically but still creates an object of the Self type, allowing one to access uninitialized memory.

class A {
  required init() {}
}
class B: A {
  static func staticMethod() {
    let foo = super.init() // OK
    print(foo is B) // true
  }
}
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis
Copy link
Collaborator Author

This now crashes during SIL generation.

@AnthonyLatsis AnthonyLatsis added the type checker Area → compiler: Semantic analysis label Jun 11, 2022
@AnthonyLatsis AnthonyLatsis added crash Bug: A crash, i.e., an abnormal termination of software SILGen Area → compiler: The SIL generation stage labels Nov 6, 2022
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 SILGen Area → compiler: The SIL generation stage type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants