Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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 Martin Sjölund, 12 years ago

Owner: changed from somebody to Martin Sjölund
Status: newaccepted

comment:2 by Martin Sjölund, 12 years ago

Summary: Handle empty arrays on the rhs of algorithmHandle empty arrays on the lhs of algorithm

comment:3 by Martin Sjölund, 12 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in r13658

comment:4 by Adrian Pop, 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 Adrian Pop, 12 years ago

We might even translate this to an NORETCALL as we really don't care about the return value.

comment:6 by Adrian Pop, 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.

Note: See TracTickets for help on using tickets.