﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1249	incorrect function of SimCode.crefIsScalar()  called from template SimCodeC.daeExpCrefRhs2()	Pavol Privitzer	Pavol Privitzer	"The attached model does not compile with the current OMC trunk.

The model hierarchy is this (only relevant fractions):

{{{model Curve
   parameter Real x[:];
   parameter Real y[:];
   parameter Real slope[:];
end Curve;

model SplineDelayByDay
   parameter Real[:,3] data;
   Curve curve(
          x=data[:, 1],
          y=data[:, 2],
          slope=data[:, 3]);
end SplineDelayByDay;

model RedCells2
    SplineDelayByDay EPOEffect(data={{0.0,0.0,0},{1.3,1.0,1.0},{4.0,4.0,0}});
end RedCells2;

model T
   RedCells2 redCells2_1;
end T;
}}}
Where generated BoundParameters() for model T has:
{{{$redCells2_1$PEPOEffect$Pcurve$Pslope$lB3$rB = (*real_array_element_addr(&$redCells2_1$PEPOEffect$Pdata, 2, 3, 3));
$redCells2_1$PEPOEffect$Pcurve$Pslope$lB2$rB = (*real_array_element_addr(&$redCells2_1$PEPOEffect$Pdata, 2, 2, 3));
$redCells2_1$PEPOEffect$Pcurve$Pslope$lB1$rB = (*real_array_element_addr(&$redCells2_1$PEPOEffect$Pdata, 2, 1, 3));
... same for x and y arrays ...
}}}
Instead of
{{{$redCells2_1$PEPOEffect$Pcurve$Pslope$lB3$rB = $redCells2_1$PEPOEffect$Pdata$lB3$c3$rB;
$redCells2_1$PEPOEffect$Pcurve$Pslope$lB2$rB = $redCells2_1$PEPOEffect$Pdata$lB2$c3$rB;
$redCells2_1$PEPOEffect$Pcurve$Pslope$lB1$rB = $redCells2_1$PEPOEffect$Pdata$lB1$c3$rB;
}}}
The incorrect decision point is in the SimCodeC.daeExpCrefRhs2() template in the condition
{{{if crefIsScalar(cr, context) then}}}
which should be true but is not. 
The problem is probably in the component references that does not have correct type,
resp. dimension information in the type (the last ident type has 1 less dimensions).

My local workaround is modification of Exp.crefHasScalarSubscripts(), where line
{{{true = listLength(dims) == listLength(subs);}}}

 is replaced with
{{{true = listLength(dims) <= listLength(subs);}}}

but the problem is elsewhere, I guess somewhere in the instatiation."	defect	closed	high			1.6.0	fixed		Pavol Privitzer Per Östlund
