restrict map_rect to legal data-only args
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 160
- Forks
- 59
- Avg merge
- 21h 45m
- Merged PRs (30d)
- 26
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the compiler's map_rect argument validation and reproduce the Stan program shown in the issue. Check that an indexed expression such as xi[i] is rejected as not entirely data-only, and verify that the invalid program no longer compiles; the issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100