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-3023] Infinite loop iterating through Array of IUOs #45613

Closed
swift-ci opened this issue Oct 22, 2016 · 2 comments
Closed

[SR-3023] Infinite loop iterating through Array of IUOs #45613

swift-ci opened this issue Oct 22, 2016 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-3023
Radar rdar://problem/27707015
Original Reporter antony.newman (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Any SWIFT system. This bug has been outstanding for Months.
MacPro / Xcode just retested and the CPU goes pretty crazy

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

md5: 23f66f4a275084af1fbaead68898b5f6

relates to:

Issue Description:

//Copy the following into a Playground and watch your CPU hit 100% 

class INK
{
    var test = 1
}

var array = [INK!](repeating: nil, count: 1)

for idx in 0..<array.count
{
    array[idx] = INK()
}

var idx2 = 0
for ink_item in array
{
    idx2 += 1
    print("idx2=\(idx2)")
}
@belkadan
Copy link
Contributor

Swift 3's supposed to reject arrays of IUOs altogether; the fact that this can be declared at all is a bug. That said, we're almost certainly checking the wrong level of optional here when deciding whether we've reached the end of the array. @rudkx, any ideas?

@DougGregor
Copy link
Member

This is fixed in Swift 4; verified with Xcode 9 beta 4.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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
Projects
None yet
Development

No branches or pull requests

3 participants