It seems like it should be straightforward to introduce a macro like TACO_ACCESS(array, length, offset) that expands to offset >= 0 && offset < length ? array[offset] : taco_assert_fail(...). This would surely catch some bugs and make tracking down bugs in the generated code easier.