WLUR and foldfix
WLUR is not foldfix aware....
noinline
int[*] add ( int[*] a, int[*] b)
{ return _add_SxS_ ( a, _sel_VxA_([0], b)); }
int main()
{
shp = [4];
a = with {
(_mul_SxV_(0,shp) <= iv < shp) : iv;
} : foldfix( add, 0, 1);
// should return 1 and *not* 6!
return a;
}
with
sac2c -V
sac2c 1.3.3-MijasCosta-771-g499e7
build-type: RELEASE
built-by: "sbs" at 2022-02-20T11:53:21
behaves like this:
sac2c error3.sac -noWLUR -noprelude
warning: With-Loop unrolling (WLUR) was disabled using the command line. However, unrolling of single-trip with-loops is required for code generation. Therefore, WLUR will be re-enabled with the maximum number of
warning: unrolling steps set to 1.
-sbs-Bodos-IMac-> ./a.out ; echo $?
1
-sbs-Bodos-IMac-> sac2c error3.sac -noprelude
-sbs-Bodos-IMac-> ./a.out ; echo $?
6