Skip to content

Commit e963b02

Browse files
author
Willi Braun
committed
- fix for #2888 git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22773 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 9fedfd5 commit e963b02

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6092,6 +6092,7 @@ algorithm
60926092
list<DAE.Var> varLst;
60936093
HashSet.HashSet ht;
60946094
list<Integer> positions;
6095+
String s, s1, s2, s3;
60956096

60966097
case (_, DAE.CAST(exp = e1), _, _, _, _)
60976098
equation
@@ -6242,16 +6243,13 @@ algorithm
62426243

62436244

62446245
// failure
6245-
case (_, _, _, _, _, _)
6246+
case (_, e1, e2, _, _, _)
62466247
equation
6247-
/*
6248-
equation
6249-
s1 = ExpressionDump.printExpStr(e1);
6250-
s2 = ExpressionDump.printExpStr(e2);
6251-
s3 = ComponentReference.crefStr(cr);
6252-
s = stringAppendList({"./Compiler/BackEnd/SimCodeUtil.mo: function createSingleComplexEqnCode2 failed for: ", s1, " = " , s2, " solve for ", s3 });
6253-
Error.addMessage(Error.INTERNAL_ERROR, {s});
6254-
*/
6248+
s1 = ExpressionDump.printExpStr(e1);
6249+
s2 = ExpressionDump.printExpStr(e2);
6250+
s3 = ComponentReference.printComponentRefListStr(crefs);
6251+
s = stringAppendList({"./Compiler/BackEnd/SimCodeUtil.mo: function createSingleComplexEqnCode2 failed for: ", s1, " = " , s2, " solve for ", s3 });
6252+
Debug.fcall(Flags.FAILTRACE, print, s);
62556253
then
62566254
fail();
62576255
end matchcontinue;
@@ -6267,12 +6265,22 @@ algorithm
62676265
local
62686266
DAE.ComponentRef cr;
62696267
HashSet.HashSet ht;
6268+
list<DAE.ComponentRef> crefs;
6269+
list<DAE.Exp> expLst;
6270+
62706271
case (DAE.CREF(componentRef=cr), _)
62716272
equation
62726273
_ = BaseHashSet.get(cr, iht);
62736274
ht = BaseHashSet.delete(cr, iht);
62746275
then
62756276
(true, ht);
6277+
/* consider also array and record crefs */
6278+
case (DAE.CREF(componentRef=cr), _)
6279+
equation
6280+
crefs = ComponentReference.expandCref(cr, true);
6281+
expLst = List.map(crefs, Expression.crefExp);
6282+
List.foldAllValue(expLst, createSingleComplexEqnCode3, true, iht);
6283+
then (true, iht);
62766284
case (DAE.RCONST(_), _) then (true, iht);
62776285
case (DAE.ICONST(_), _) then (true, iht);
62786286
case (DAE.BCONST(_), _) then (true, iht);

0 commit comments

Comments
 (0)