#1907 closed defect (fixed)
Handle empty arrays on the lhs of algorithm
Reported by: | Adeel Asghar | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Frontend | Version: | |
Keywords: | Cc: | Martin Sjölund |
Description
Assignment to array of size 0 fails with an error message,
Error: Failed elaborate assignment for some unknown reason:
Change History (6)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 12 years ago
Summary: | Handle empty arrays on the rhs of algorithm → Handle empty arrays on the lhs of algorithm |
---|
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:4 by , 12 years ago
I think this is the wrong fix.
As far as I can tell in equations empty array crefs are
replaced by {}, but in case of algorithms we cannot do that.
However, an array variable with size 0 disappears from the
flattened code so it will not be present.
That's why we get the errors to missing variables.
I think that LHS arrays references with size 0 should be
replaced with WILD as we don't care about the result but
we still want to call the function as it might have some
side effects.
comment:5 by , 12 years ago
We might even translate this to an NORETCALL as we really don't care about the return value.
comment:6 by , 12 years ago
More on this for Adeel. Adeel you could translate the model a bit differently if number of states is 0. Do not declare fmi_x and fmi_x_new at all and don't use it in the lhs.
Fixed in r13658