Skip to content

[SR-13305] Derivative function protocol witness SILGen crash for non-wrt inout parameter #55745

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

Closed
dan-zheng opened this issue Jul 27, 2020 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@dan-zheng
Copy link
Contributor

Previous ID SR-13305
Radar None
Original Reporter @dan-zheng
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee @dan-zheng
Priority Medium

md5: 5025ef37b09b0ab538d4ba0382ddf907

Issue Description:

import _Differentiation

protocol MyProtocol {
  @differentiable(wrt: weight)
  func execute(weight: Float, outputs: inout Float)
}

struct Impl: MyProtocol {
  func execute(weight: Float, outputs: inout Float) {
    outputs = weight
  }
}
$ swiftc sr-13305.swift
Assertion failed: (!array.empty() && "claiming next from empty array!"), function claimNext, file /Users/danielzheng/swift-bart/swift/lib/SILGen/SILGenPoly.cpp, line 112.
Stack dump:
...
1.  Swift version 5.3-dev (LLVM 7bfb26db929c00a, Swift 3263d261f1e42cf)
2.  While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "sr-13305.swift")
3.  While generating SIL witness table protocol conformance to 'MyProtocol' (at sr-13305.swift:3:1) for type 'Impl' (declared at [sr-13305.swift:8:1 - line:12:1] RangeText="struct Impl: MyProtocol {
  func execute(weight: Float, outputs: inout Float) {
    outputs = weight
  }
")
4.  While generating protocol witness thunk SIL function "@AD__$s4main4ImplVAA10MyProtocolA2aDP7execute6weight7outputsySf_SfztFTW_jvp_SUU".
 for 'execute(weight:outputs:)' (at sr-13305.swift:9:3)
5.  While emitting reabstraction thunk in SIL function "@$sSfIegy_S2fIegyd_TR".
 for <<debugloc at "<compiler-generated>":0:0>>0  swift-frontend           0x0000000111aa5105 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift-frontend           0x0000000111aa40b8 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x0000000111aa5706 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff6a3e15fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338733709856
5  libsystem_c.dylib        0x00007fff6a2b7808 abort + 120
6  libsystem_c.dylib        0x00007fff6a2b6ac6 err + 0
7  swift-frontend           0x000000010be046cd swift::SILResultInfo const& claimNext<swift::SILResultInfo>(llvm::ArrayRef<swift::SILResultInfo>&) + 93
8  swift-frontend           0x000000010be032e0 (anonymous namespace)::ResultPlanner::claimNextInnerResult((anonymous namespace)::ResultPlanner::PlanData&) + 32
@dan-zheng
Copy link
Contributor Author

Retroactively triaging bugs: fixed in #33304.

@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.
Projects
None yet
Development

No branches or pull requests

1 participant