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-7305] Error when accessing .keys or .values on [String: Int] #49853

Closed
NevinBR opened this issue Mar 29, 2018 · 2 comments
Closed

[SR-7305] Error when accessing .keys or .values on [String: Int] #49853

NevinBR opened this issue Mar 29, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution standard library Area: Standard library umbrella

Comments

@NevinBR
Copy link
Contributor

NevinBR commented Mar 29, 2018

Previous ID SR-7305
Radar None
Original Reporter @NevinBR
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 9.2
Swift 4.0.3

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, RunTimeCrash
Assignee None
Priority Medium

md5: e4b5cff3872bd85ec09b6dd65bfb1e6b

duplicates:

  • SR-6003 EXC_BAD_ACCESS (code=EXC_I386_GPFLT) when accessing dictionary keys

Issue Description:

Example:

let myDict = ["a": 1]
let myKeys = myDict.keys        // error
let myVals = myDict.values      // also an error

// error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=EXC_I386_GPFLT).

This produces a “bad access” error in playgrounds and compiled programs in Xcode, but not in the Swift REPL from the command line.

If the dictionary has Int keys, there is no error.

@belkadan
Copy link
Contributor

I don't see this behavior with Xcode 9.3. @lorentey, does this sound like something we fixed in Swift 4.1?

@lorentey
Copy link
Member

This is caused by an issue with mirroring Dictionary's views; it was fixed in 4.1 by having them conform to CustomStringRepresentible:

https://bugs.swift.org/browse/SR-6003

@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. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

4 participants