Define semantics for out-of-bounds array accesses in IR
Open
documentation
ir
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Out-of-bounds ArrayIndex operations clamp the index to the highest element:
https://github.com/google/xls/blob/ec980d843016e7b7257aeedc4fffd06d8198aa3b/xls/ir/ir_interpreter.cc#L256
Out-of-bounds ArrayUpdate operations are noops:
https://github.com/google/xls/blob/ec980d843016e7b7257aeedc4fffd06d8198aa3b/xls/ir/ir_interpreter.cc#L268
This is not very consistent because we clamp only in the ArrayIndex case. We should think about what semantics we want here. One option is to make OOB ArrayIndex return the zero value. Alternatively OOB behavior could be configurable.
Contributor guide
Assessment
This issue has not been assessed yet.