-
-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
Description
Current Behavior:
Enabling compiler optimizations currently stops emitting a default assignment for a variable if it is immediately assigned to (#1029). However, this changes the behavior of those very assign functions when it comes to bounds checks:
This means the same model:
parameters {
vector[3] y;
}
model {
vector[2] x;
x = y;
y ~ std_normal();
// prevent copy-elision and dead-code-elimination on x
x[1] = 0;
print(x);
}Will throw an error at --O0:
Unrecoverable error evaluating the log probability at the initial value.
Exception: vector assign rows: assigning variable x (2) and right hand side rows (3) must match in size (in '../../ml/stanc3/bounds.stan', line 12, column 4 to column 10)
Exception: vector assign rows: assigning variable x (2) and right hand side rows (3) must match in size (in '../../ml/stanc3/bounds.stan', line 12, column 4 to column 10)
But will sample to completion at --O1.
Expected Behavior:
Bounds checks are applied uniformly.
Reactions are currently unavailable