Skip to content

[SR-1814] Crash on assignment of class array to protocol array #44423

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-1814
Radar None
Original Reporter willclarke (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode Version 7.3.1 (7D1014)

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

md5: 52e26ca1ca9ed52842e02ada95731ce5

relates to:

  • SR-1813 Swift crashes emitting witness tables

Issue Description:

Run this code in a new command line app:

import Foundation

print("Hello, World!")

protocol P1 {}
protocol P2 {}
protocol P3: P1, P2 {}
class C4: P3 {}

var p1: [P1] = [C4()]
var p2: [P2] = [C4()]
var c4 = [C4()]

p1 = c4

Backtrace:

Hello, World!
fatal error: array cannot be bridged from Objective-C
(lldb) bt

  • thread Redundant Load Elimination Patches #1: tid = 0x1bd422, 0x00000001001a2f58 TestProject`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00000001001a2f58 TestProject`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40
    frame Redundant Load Elimination Patches #1: 0x00000001000355df TestProject`Swift._arrayForceCast <A, B> (Swift.Array<A>) -> Swift.Array<B> + 831

  • frame Remove unnecessary unsafeUnwrap calls. #2: 0x000000010026d737 TestProject`main + 519 at main.swift:22
    frame Initial implementation of a @_cdecl attribute to export top-level functions to C #3: 0x00007fff9aaca5ad libdyld.dylib`start + 1
    (lldb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during executionruntimeThe Swift Runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions