hellas-ai / hellas-ai/catgrad

unpack::<N> should fail typecheck on rank-M (M != N) shapes

Open
#306 4 comments 0 reactions 1 assignee Claimed by @statusfailed View on GitHub
bug good first issue
Dominant language
Rust
Stars
34
Forks
7
PR merge metrics
No merged PRs in 30d

Description

The problem is [here](https://github.com/hellas-ai/catgrad/blob/master/catgrad/src/abstract_interpreter/eval.rs#L58):

```rust
// write each result into state at op.targets ids
for ((node_id, _), result) in ssa.targets.iter().zip(results) {
on_write(*node_id, &result);
if state.insert(*node_id, result).is_some() {
return Err(InterpreterError::MultipleWrite(*node_id));
}
}
```

Namely: rust's `zip` is silently truncating one of the iterators.

**Fix**: insert a length check that there are exactly as many results as targets.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.