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-9770] Singleton Initializer can enter Infinite Loop #4611

Open
swift-ci opened this issue Jan 26, 2019 · 3 comments
Open

[SR-9770] Singleton Initializer can enter Infinite Loop #4611

swift-ci opened this issue Jan 26, 2019 · 3 comments
Labels
bug Something isn't working Compiler LLDB for Swift

Comments

@swift-ci
Copy link

Previous ID SR-9770
Radar https://bugreport.apple.com/web/?problemID=47576365
Original Reporter spamsencer (JIRA User)
Type Bug
Environment

Swift 4.2

Xcode 10.1 (10B61)

macOS 10.14.2 (18C54)

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

md5: 265449bf1b4b45378b6f0bec0aede923

Issue Description:

When creating a Swift Singleton object as follows:

static let sharedHandler = SomeHandler()

If the singleton initializes top-level variables at the time of initialization, and if those variables' initializers reference the singleton object, the execution thread enters an infinite loop.

@belkadan
Copy link

I don't think there's a fix for this, but maybe we could at least detect the infinite loop in debug builds or something, so we get a more reliable error?

@swift-ci
Copy link
Author

Comment by Samuel Spencer (JIRA)

Agreed – seems like something that could potentially be caught / warned against at build time. Any suggestions on where I might go looking around to make a contribution for this?

@belkadan
Copy link

belkadan commented Nov 2, 2019

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Compiler LLDB for Swift
Projects
None yet
Development

No branches or pull requests

2 participants