Skip to content

[SR-15823] [AutoDiff] Runtime segfault from edge case #58097

Open
@philipturner

Description

@philipturner
Previous ID SR-15823
Radar None
Original Reporter @philipturner
Type Bug

Attachment: Download

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

md5: 7ac04b0e86fad47aa1f9a8580634f6ab

Issue Description:

The following code crashes at runtime under specific conditions as explained below. As-is, it crashes. To stop it from crashing, follow instructions in its comments.

import _Differentiation

// Remove the @noDerivative attribute here...
typealias MyType = @differentiable(reverse) (inout Float, @noDerivative Int) -> Void

@differentiable(reverse)
// ... and here to stop it from crashing.
func myFunc(_ x: inout Float, _ y: @noDerivative Int) -> Void {}

// Alternatively, un-comment out this line and it no longer crashes.
//print("hi")
print(myFunc as MyType)

Metadata

Metadata

Assignees

No one assigned

    Labels

    AutoDiffSILGenArea → compiler: The SIL generation stagebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareswift 5.9

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions