Skip to content

Commit

Permalink
- Fixed codegen for if-expressions of array crefs
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9865 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 18, 2011
1 parent ba37dd0 commit ac416a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Compiler/susan_codegen/SimCode/SimCodeC.tpl
Expand Up @@ -5094,7 +5094,7 @@ case IFEXP(__) then
let eThen = daeExp(expThen, context, &preExpThen /*BUFC*/, &varDecls /*BUFD*/)
let &preExpElse = buffer "" /*BUFD*/
let eElse = daeExp(expElse, context, &preExpElse /*BUFC*/, &varDecls /*BUFD*/)
let shortIfExp = if preExpThen then "" else if preExpElse then "" else "x"
let shortIfExp = if preExpThen then "" else if preExpElse then "" else if isArrayType(typeof(exp)) then "" else "x"
(if shortIfExp
then
// Safe to do if eThen and eElse don't emit pre-expressions
Expand Down
5 changes: 5 additions & 0 deletions Compiler/susan_codegen/SimCode/SimCodeTV.mo
Expand Up @@ -1984,6 +1984,11 @@ package Expression
output list<DAE.Exp> expLst;
end flattenArrayExpToList;

function isArrayType
input DAE.ExpType e;
output Boolean b;
end isArrayType;

end Expression;

package ExpressionDump
Expand Down

0 comments on commit ac416a7

Please sign in to comment.