Skip to content

Commit

Permalink
Bug fix for arrayReplaceAtWithFill, it created an array that was one …
Browse files Browse the repository at this point in the history
…element longer than what was requested.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6526 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Otto Tronarp committed Oct 22, 2010
1 parent 8f4c254 commit a20d850
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Compiler/Util.mo
Expand Up @@ -4454,20 +4454,20 @@ algorithm
outTypeAArray:=
matchcontinue (inTypeA1,inInteger2,inTypeAArray3,inTypeA4)
local
Integer alen,pos,pos_1;
Integer alen,pos;
Type_a[:] res,arr,newarr,res_1;
Type_a x,fillv;
case (x,pos,arr,fillv)
equation
alen = arrayLength(arr) "Replacing element with index in range of the array" ;
(pos < alen) = true;
(pos <= alen) = true;
res = arrayUpdate(arr, pos , x);
then
res;
case (x,pos,arr,fillv)
equation
pos_1 = pos + 1 "Replacing element out of range of array, create new array, and copy elts." ;
newarr = fill(fillv, pos_1);
//Replacing element out of range of array, create new array, and copy elts.
newarr = fill(fillv, pos);
res = arrayCopy(arr, newarr);
res_1 = arrayUpdate(res, pos , x);
then
Expand Down

0 comments on commit a20d850

Please sign in to comment.