Skip to content
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

[SR-13447] JVPCloner visitDestroyValueInst crash #55889

Closed
swift-ci opened this issue Aug 25, 2020 · 1 comment
Closed

[SR-13447] JVPCloner visitDestroyValueInst crash #55889

swift-ci opened this issue Aug 25, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13447
Radar None
Original Reporter aefr (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee aefr (JIRA)
Priority Medium

md5: a4239aae31943d3c39b12e46c76ebf36

Issue Description:

Reproducing code:

final class ClassTangentPropertyNotStored: Differentiable {
  var x: Float = 0

  struct TangentVector: Differentiable, AdditiveArithmetic {
    var x: Float { 0 }
  }
  func move(along direction: TangentVector) {}
}

@differentiable
func testClassTangentPropertyNotStored(_ c: ClassTangentPropertyNotStored) -> Float {
  var tmp = c
  return tmp.x
}

Error:

Assertion failed: (!operand->getType().isTrivial(getFunction()) && "Should not be passing trivial values to this api. Use instead " "emitDestroyValueOperation"), function createDestroyValue ...

Stack dump:

Stack dump:
0.  Program arguments: /Users/aefr/swiftdir/build/Ninja-ReleaseAssert+swift-DebugAssert/swift-macosx-x86_64/bin/swift-frontend -target x86_64-apple-macosx10.9 -module-cache-path /Users/aefr/swiftdir/build/Ninja-ReleaseAssert+swift-DebugAssert/swift-macosx-x86_64/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache -sdk /Users/aefr/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.16.sdk -swift-version 4 -ignore-module-source-info -typo-correction-limit 10 -emit-sil -enable-experimental-forward-mode-differentiation -verify /Users/aefr/swiftdir/swift/test/AutoDiff/SILOptimizer/forward_mode_diagnostics.swift 
1.  Swift version 5.3-dev (LLVM 03a20a7d045e034, Swift 445675a718a7b92)
2.  While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for forward_mode_diagnostics.forward_mode_diagnostics)
3.  While running pass #​1323 SILModuleTransform "Differentiation".
4.  While processing // differentiability witness for test_class_tangent_property_not_stored
sil_differentiability_witness hidden [parameters 0] [results 0] @test_class_tangent_property_not_stored : $@convention(thin) (@guaranteed ClassTangentPropertyNotStored) -> Float {
}

 on SIL function "@test_class_tangent_property_not_stored".
 for 'testClassTangentPropertyNotStored(_:)' (at /Users/aefr/swiftdir/swift/test/AutoDiff/SILOptimizer/forward_mode_diagnostics.swift:283:1)
5.  While generating JVP and differential for SIL function "@test_class_tangent_property_not_stored".
 for 'testClassTangentPropertyNotStored(_:)' (at /Users/aefr/swiftdir/swift/test/AutoDiff/SILOptimizer/forward_mode_diagnostics.swift:283:1)
0  swift-frontend           0x000000011361b885 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift-frontend           0x000000011361a838 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x000000011361be86 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff70c1e5fd _sigtramp + 29
4  swift-frontend           0x00000001160bae28 cmark_strbuf__initbuf + 1301091
5  libsystem_c.dylib        0x00007fff70af4808 abort + 120
6  libsystem_c.dylib        0x00007fff70af3ac6 err + 0
7  swift-frontend           0x000000010e8e91da swift::SILBuilder::createDestroyValue(swift::SILLocation, swift::SILValue) + 234
8  swift-frontend           0x000000010e704ce2 swift::SILBuilder::emitDestroyValue(swift::SILLocation, swift::SILValue) + 450
9  swift-frontend           0x000000010dad2bb1 swift::autodiff::JVPCloner::Implementation::emitTangentForDestroyValueInst(swift::DestroyValueInst*) + 241
10 swift-frontend           0x000000010dabf8ca swift::autodiff::JVPCloner::Implementation::visitDestroyValueInst(swift::DestroyValueInst*) + 90
@dan-zheng
Copy link
Collaborator

Fixed in #33633.

@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

2 participants