WRCI with -dopra allows array reuse on same-partition indexing
Extended Description
Created an attachment (id=990)
source code to reproduce fault
Indexed references within a modarray that refer to the current
partition should prohibit array reuse. Compiling with -dopra,
however, thinks it can operate in place. This causes
wrong answers in the wrci unit test bug980.breaks.sac
and also can be seen here:
sac@rattler:~/sac/testsuite/optimizations/wrci$ sac2c wrciOffsetTooSmall.sac -v1 -dopra -bopt:wrci -nowlf |grep RC
modarray( AAA ,RC(AAA));
sac@rattler:~/sac/testsuite/optimizations/wrci$ sac2c wrciOffsetTooSmall.sac -v1 -bopt:wrci |grep RC
sac@rattler:~/sac/testsuite/optimizations/wrci$ cat wrciOffsetTooSmall.sac /*
* Attempt to unit test RWO (Reuse With Offset), based
* on zero documentation in the C code.
*
* AAA should NOT be a datareuse candidate, because
* the index offset refers to data in the same partition.
* See RWOprf for this case.
*
*/
/* RESULT: RC(AAA) 0 0 */
use Array: all;
int main()
{
AAA = _reshape_VxA_( [ 25, 10], iota( 250));
AAA = with {
([0,0] <= iv < [10,10]): AAA[iv + [ 9, 0]] + 1000;
} : modarray(AAA);
//StdIO::print(AAA);
z = sum( AAA);
//StdIO::print(z);
z = _sub_SxS_( z, 140125);
return( z);
}
sac@rattler:~/sac/testsuite/optimizations/wrci$ sac2c -V
sac2c v1.00-beta (Haggis And Apple)
product rev 18312 linux-gnu_x86_64
(Thu Oct 3 14:40:19 EDT 2013 by sac)