Skip to content

Commit

Permalink
Fix for #2192:
Browse files Browse the repository at this point in the history
- Made ComponentReference.expandSlice fail silently, since it's used in places
  where it's expected to fail.
- Fixed code generation for variable subscripts.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16112 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed May 23, 2013
1 parent 25322d7 commit 9e60c21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 0 additions & 8 deletions Compiler/FrontEnd/ComponentReference.mo
Expand Up @@ -2859,14 +2859,6 @@ algorithm
case DAE.ARRAY(array = expl)
then List.map(expl, Expression.makeIndexSubscript);

else
equation
exp_str = ExpressionDump.printExpStr(inSliceExp);
err_str = "ComponentReference.expandSlice: Unknown slice " +& exp_str;
Error.addMessage(Error.INTERNAL_ERROR, {err_str});
then
fail();

end match;
end expandSlice;

Expand Down
9 changes: 8 additions & 1 deletion Compiler/Template/CodegenC.tpl
Expand Up @@ -8691,11 +8691,18 @@ template dimension(Dimension d)
case DAE.DIM_BOOLEAN(__) then '2'
case DAE.DIM_INTEGER(__) then integer
case DAE.DIM_ENUM(__) then size
case DAE.DIM_EXP(exp=e) then dimensionExp(e)
case DAE.DIM_UNKNOWN(__) then error(sourceInfo(),"Unknown dimensions may not be part of generated code. This is most likely an error on the part of OpenModelica. Please submit a detailed bug-report.")
case DAE.DIM_EXP(exp=e) then error(sourceInfo(), 'dimension: INVALID_DIMENSION <%printExpStr(e)%>')
else error(sourceInfo(), 'dimension: INVALID_DIMENSION')
end dimension;

template dimensionExp(DAE.Exp dimExp)
::=
match dimExp
case DAE.CREF(componentRef = cr) then cref(cr)
else error(sourceInfo(), 'dimensionExp: INVALID_DIMENSION <%printExpStr(dimExp)%>')
end dimensionExp;

template algStmtAssignPattern(DAE.Statement stmt, Context context, Text &varDecls)
"Generates an assigment algorithm statement."
::=
Expand Down

0 comments on commit 9e60c21

Please sign in to comment.