Open WardBrian opened 1 day ago
Honestly, the lazy code motion pass seems to me to be so broken that I'm not even positive this is worth fixing. The very next line is
stan::model::assign(theta, lcm_sym7__, "assigning variable theta");
Which, if you do the obvious thing and just assign directly to theta, prevents the bug. I have no idea what LCM is thinking here, and I believe this is also the pass that will move things from transformed data
into e.g. the model block, which is obviously wrong. https://github.com/stan-dev/stanc3/issues/860 seems related
Initially reported https://github.com/stan-dev/cmdstan/issues/1299
This stan code:
When compiled with
--Oexperimental
, creates this C++:The assign here fails because lcm_sym7__ is AoS, but x (and therefor the return of multiply) is SoA.