WLF bug - weird out-of-bound-access error message
out-of-bound error in WLF. Using sac2c sac2c 1.3.3-MijasCosta-1004-ge257a-dirty build-type: DEBUG
the following program:
int + (int a, int b) {return _add_SxS_ (a, b); }
int main()
{
a = with {} : genarray ([5,10], 0);
c = with {} : genarray([10,10], 0);
new = with {
( [0,0] <= [i,j] < [5,5]) : with { ([0] <= [k] < [10]): _sel_VxA_ ([i,k], a);
} : fold (+,0);
} : genarray ([5,5], 0);
c = with {
( [5,0] <= iv < [10,5] ) : _sel_VxA_ (_sub_VxV_( iv , [5,0]), new) ;
} : modarray (c);
return _sel_VxA_ ([5,2], c);
}
yields:
-sbs-SvenBodosAir2-> sac2c-d WLFbug.sac
** 1: Loading SAC program ...
** 2: Preprocessing SAC program ...
** 3: Running module system ...
** 4: Simplifying source code ...
** 5: Converting to static single assignment form ...
** 6: Running type inference system ...
** 7: Processing exports ...
** 8: Preparing for code optimization ...
** 9: Enhancing with-loops ...
** 10: Running SAC optimizations ...
./WLFbug.sac:9:87: abort:
Array access to a out of range in dimension 1
Compilation failed while Running SAC optimizations.