Opened 13 years ago

Last modified 13 years ago

#1671 closed defect (fixed)

Code generation fails

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: high Milestone:
Component: Version:
Keywords: Cc: Martin Sjölund, Frenkel TUD

Description

From: http://www.openmodelica.org/index.php/forum/topic?id=481

This seems to have some issues either with alias elimination or some other stuff in generated code:
{{{record Value

Real a;

end Value;

function Func

input Value v;
output Real a;

algorithm

a := v.a;

end Func;

model Model

Value[1] values;
Value v;
Real a;

equation

v = values[1];
a = Func(values[1]); This leads to a compilation error
a = Func(v); This does work

end Model;

model Test

Model m(values = values);
Value[1] values;

equation

values[1].a = 1;

end Test;}}}

Change History (3)

comment:1 by Martin Sjölund, 13 years ago

From simCodeTarget=Dump:
{{{simple equation: m.a = Func(m.values[1])
m.values[1].a alias of values[1].a}}}

So the alias elimination fails to find this one alias.
I'll see if I can fix this myself quickly, otherwise I leave it up to Jens.

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

Ok, I followed the code for quite some time fixing the problem that the non-constant m.a = Func(m.values[1]) ended up among the known variables (did not commit this as the fix does not solve everything). There is still the problem of m.values being an alias of values, meaning m.values[1] is part of generated code. But assumed to have been replaced by values[1] everywhere.

comment:3 by Jens Frenkel, 13 years ago

wrong IncidenceMatrix, wrong splitted system, missed replacement of alias variable from other subsystem
fixed in 10858

Note: See TracTickets for help on using tickets.