Internal error when upper bound of the fold-wl is out of range
/tmp|=> cat b.sac
int +(int a, int b) {return _add_SxS_ (a, b);}
int sum(int[.] a) {
return with {
([0] <= iv <= _shape_A_ (a)): _sel_VxA_ (iv, a);
}: fold (+, 0);
}
int main() {
return sum([2,3]);
}
Dies with:
Internal compiler error
Assertion "cvidx[0] < SHgetExtent (shp, 0)" failed at /tmp/sac2c/src/libsac2c/constants/constants_struc_ops.c:56 -- Idx2Offset called with idx out of range
Please file a bug at: http://bugs.sac-home.org
I do realise that the the fold with-loop goes out of bounds, but this shouldn't be an internal error.