Skip to content

[SR-10269] Crash on AnyKeyPath.== infix(_:_:) only on 32-bit devices #52669

@swift-ci

Description

@swift-ci
Previous ID SR-10269
Radar None
Original Reporter Evilutiuoner (JIRA User)
Type Bug
Environment
  • only on iOS 10.x (32 bit devices) but it is 100% reproducible

  • only on prod or test-flight Apps, unable to reproduce on dev builds

  • Xcode 10.1 b10B61 (Swift 4.2.1)

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

md5: ecd1b60c63f24ca82c43cc1192c6169f

Issue Description:

Crashed source code:

public enum NetModelFillingType<Model> {
    case selectedFields(keyPathes: [PartialKeyPath<Model>])
    case notSpecified
}

public protocol StandardNetModelFilling {
    associatedtype Model
    var fillMode: NetModelFillingType<Model> { get }
}

public struct UserNetModel: StandardNetModelFilling {
    public var fillMode = NetModelFillingType<UserNetModel>.notSpecified
    public var firstName: String?
    public var lastName: String?
}

var model = UserNetModel()
model.fillMode = .selectedFields(keyPathes: [\UserNetModel.firstName, \UserNetModel.lastName])


if case .selectedFields(let keyPathes) = model.fillMode {
    for keyPath in keyPathes {
        switch keyPath {
        case \UserNetModel.firstName: break
        case \UserNetModel.lastName: break // crash on accesss !!!!!!!
        default: break
        }
    }
}

Crashed stacktrace:

specialized closure #&#8203;1 in closure #&#8203;1 in static AnyKeyPath.== infix(_:_:) (<compiler-generated>)
partial apply for thunk for @callee_guaranteed (@unowned KeyPathBuffer) -> (@unowned Bool, @error @owned Error) (<compiler-genera
partial apply for thunk for @callee_guaranteed (@unowned KeyPathBuffer) -> (@unowned Bool, @error @owned Error) (<compiler-genera
thunk for @callee_guaranteed (@unowned KeyPathBuffer) -> (@unowned Bool, @error @owned Error)partial apply + 26990833
swift_errorInMain + 498610
UserEntity.updateDataFields(with:in:keyPathes:) (UserEntity.swift:115)

Metadata

Metadata

Assignees

No one assigned

    Labels

    32 bit onlybugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwarekey pathsFeature: key paths (both native and Objective-C)run-time crashBug → crash: Swift code crashed during executionstandard libraryArea: Standard library umbrella

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions