Skip to content

[SR-14222] [AutoDiff] Incorrect derivative for array literal with tuple_element_addr elements #54214

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
Tracked by #77773
dan-zheng opened this issue Nov 18, 2019 · 1 comment · Fixed by #78355
Closed
Tracked by #77773
Labels
array literals Feature → expressions → literals: Array literals AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself expressions Feature: expressions SILOptimizer Area → compiler: SIL optimization passes swift 6.0 unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@dan-zheng
Copy link
Contributor

Previous ID SR-14222
Radar None
Original Reporter @dan-zheng
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, AutoDiff
Assignee None
Priority Medium

md5: 0184cfd78c8d9dc3932d9cb75b334ce8

Issue Description:

func tupleElementGeneric<T>(_ x: T, _ y: T) -> [T] {
  var tuple = (x, y)
  return [tuple.0, tuple.1]
}
let pb = pullback(at: Float(3), 4, in: { tupleElementGeneric($0, $1) })
print(pb(.init([1, 1])))
//   Actual: (0.0, 2.0)
// Expected: (1.0, 1.0)
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@jkshtj
Copy link
Contributor

jkshtj commented May 3, 2024

Throws an error on the 05/24 toolchain.

/Users/kshitij/workspace/scratch/test.swift:7:18: error: incorrect argument label in call (have 'at:_:in:', expected 'at:_:of:')
 5 |   return [tuple.0, tuple.1]
 6 | }
 7 | let pb = pullback(at: Float(3), 4, in: { tupleElementGeneric($0, $1) })
   |                  `- error: incorrect argument label in call (have 'at:_:in:', expected 'at:_:of:')
 8 | print(pb(.init([1, 1])))
 9 |

/Users/kshitij/workspace/scratch/test.swift:8:11: error: cannot infer contextual base in reference to member 'init'
 6 | }
 7 | let pb = pullback(at: Float(3), 4, in: { tupleElementGeneric($0, $1) })
 8 | print(pb(.init([1, 1])))
   |           `- error: cannot infer contextual base in reference to member 'init'
 9 |
10 | //   Actual: (0.0, 2.0)

kovdan01 added a commit to kovdan01/swift that referenced this issue Dec 23, 2024
The `adjIndex` was not incremented due to missed `remapType`.

Fixes swiftlang#54214
@asl asl closed this as completed in #78355 Jan 7, 2025
@asl asl closed this as completed in 95f34eb Jan 7, 2025
@AnthonyLatsis AnthonyLatsis added unexpected behavior Bug: Unexpected behavior or incorrect output SILOptimizer Area → compiler: SIL optimization passes expressions Feature: expressions array literals Feature → expressions → literals: Array literals swift 6.0 labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
array literals Feature → expressions → literals: Array literals AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself expressions Feature: expressions SILOptimizer Area → compiler: SIL optimization passes swift 6.0 unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants