Opened 14 years ago
Last modified 9 years ago
#1441 new defect
Removing STMT_TUPLE_ASSIGN — at Initial Version
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | |
Keywords: | Cc: | Martin Sjölund, Adrian Pop, Peter Aronsson |
Description
Tuple assignments have a problem today:
{{{class B
function fn
output Integer o1 := 1;
output Integer o2 := 2;
annotation(OpenModelica_Impure = true);
algorithm
end B;}}}
Class B would accept (r1,r2) := fn(), which works in this particular case (because in the C-code, a double can be assigned an integer at the loss of precision (>48-bit long ints; not a big issue)).
The big problem here is that converting an integer array to real array or unboxing returned data is not performed. We could either remove STMT_TUPLE_ASSIGN altogether (replace it with pattern assignments - my favorite) or extend the type to include a list of types so that the code generation can perform necessary casts but this does not always work.
We could also make the STMT_TUPLE_ASSIGN statement return a temporary variable plus a list of (non-tuple) assignments performed on this temp.var.
For now, I'll change the implementation to only check for subtype instead of type conversions, see if the testsuite runs, and commit.