Open
Description
The following program should not compile because xi[i]
isn't an entirely data-only expression. The value xi
is a data variable, but the index i
is local. That allows illegal programs like this to get compiled:
functions {
vector f(vector beta, vector theta, data real[] xr, data int[] xi ) {
return [1.0]';
}
}
transformed data {
vector[2] beta;
vector[2] theta[2];
real xr[2, 2];
int xi[2, 2, 2];
}
parameters {
real y;
}
transformed parameters {
real s = 0;
for (i in 1:2) {
// BAD! DATA CHANGING BETWEEN CALLS
s += sum(map_rect(f, beta, theta, xr, xi[i]));
}
}
These will produce different results with MPI turned on and turned off, which we don't ever want to happen.