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-4477] Protocol composition results in EXC_BAD_ACCESS #47054

Closed
swift-ci opened this issue Apr 3, 2017 · 3 comments
Closed

[SR-4477] Protocol composition results in EXC_BAD_ACCESS #47054

swift-ci opened this issue Apr 3, 2017 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. runtime The Swift Runtime standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 3, 2017

Previous ID SR-4477
Radar rdar://problem/31404278
Original Reporter salutis (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, Runtime
Assignee salutis (JIRA)
Priority Medium

md5: c528652076c750121e14e91c0b0093b8

is duplicated by:

  • SR-5043 App crashes when calling method on downcasted object

Issue Description:

An EXC_BAD_ACCESS here:

protocol Something {}

protocol IntContainer {
    var ints: [Int] { get set }
}

func processSomething(_ state: Something) {
    if let intContainer = state as? Something & IntContainer {
        print(intContainer.ints)
    }
}

struct MySomething: Something, IntContainer {
    var ints: [Int] = []
}

let mySomething = MySomething()
processSomething(mySomething) // EXC_BAD_ACCESS here

The execution stops here:

libswiftCore.dylib`_swift_release_dealloc:
    0x11be163e0 <+0>: movq   (%rdi), %rax
->  0x11be163e3 <+3>: jmpq   *-0x10(%rax)
    0x11be163e6 <+6>: nopw   %cs:(%rax,%rax)

Related StackOverflow question with no good answer:
http://stackoverflow.com/questions/35199077/exc-bad-access-using-protocol-composition

@jckarter
Copy link
Member

jckarter commented Apr 3, 2017

@swift-ci create

@jckarter
Copy link
Member

jckarter commented May 9, 2017

Trying a fix for master: #9429
And for 4.0: #9430

@jckarter
Copy link
Member

Merged. Should be fixed in future snapshots.

@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. runtime The Swift Runtime standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants