| // RUN: %target-swift-emit-sil -enable-experimental-forward-mode-differentiation %s |
| // REQUIRES: asserts |
| |
| // TF-1033: Ownership verification error in differential function generated by |
| // the differentiation transform. |
| // Differential generation sees a `copy_addr [take]` in original function and |
| // emits a `copy_addr [take]` in the differential function, but this is |
| // problematic because the source buffer in the differential function is not |
| // fully initialized. |
| |
| @_silgen_name("tuple") |
| @differentiable |
| func tupleInitialNonactive<T: AdditiveArithmetic & Differentiable>(_ x: T) -> T { |
| var tuple = (T.zero, T.zero) |
| tuple.0 = x |
| return tuple.0 |
| } |
| |
| // SIL memory lifetime failure in @AD__tuple__differential_src_0_wrt_0: memory is not initialized, but should |
| // memory location: %15 = tuple_element_addr %14 : $*(τ_0_0.TangentVector, τ_0_0.TangentVector), 0 // user: %16 |
| // at instruction: copy_addr [take] %7 to %10 : $*τ_0_0.TangentVector // id: %11 |