Extended Description
Created an attachment (id=689)
source code to reproduce fault
The SelModArray optimization in CF is intended to take this
common set of expressions:
X = idx_modarray_AxVxS_( M, iv, q);
z = idx_sel_VxA( iv, X);
and turn it into:
z = q;
This optimization is of fundamental importance in loop
fusion/array contraction, and WLF/AWLF, because it allows
us to eliminate intermediate array results.
When a function is compiled with -ecc (or -check c), however,
with my local mods to unroll guards, we end up with this sort
of pattern:
lim = ...;
p0... = {earlier guard(s)}
iv = [ i ];
q = 42;
M' = _modarray_AxVxS_( M, iv, q);
X = _afterguard_( M' , p0...);
i' , p1 = _val_lt_val_SxS_( i, lim);
iv' = [ i'];
z' = _sel_VxA_( iv', X);
z = _afterguard_( z', p1);
We want to map this into:
z = _afterguard( q, p0, p1, ...);
There are several problems here:
1. We don't want to lose the afterguards on p0, p1.
In fact, finding the afterguard on z is a bit of
a problem, if we're looking at the z' computation...
2. We have to chase X back to the M' modarray computation,
through the X afterguard.
3. We have to somehow match iv' and iv, through guards.
This is a unit test from CF, which fails reliably in my local code, if
compiled with:
sac2c -docf -extrema -nowlf -doawlf -ecc SCCFprf_modarray11.sac
This with Build #rev 16795:16801:MODIFIED, which I hope to check in
soon, and fix this one later.