Compilation failure for functions returning two dimensional arrays
The following model fails at compile time using r24377. It works using r23420. It seems to be caused by functions returning multidimensional arrays.
loadString("
model arrayFuncBug
parameter Real a = 1;
Real arr[3, 3];
equation
arr = func(a = a);
end arrayFuncBug;
function func
input Real a = 0.01;
output Real arr[3, 3];
algorithm
arr := diagonal({a ^ 2, a ^ 3, a ^ 4});
end func;
");
buildModel(arrayFuncBug);
The log file contains:
arrayFuncBug_functions.c: In function 'omc_func':
arrayFuncBug_functions.c:24: error: incompatible type for argument 3 of 'array_alloc_real_array'
C:/OpenModelica1.9.2Nightly//include/omc/c/util/real_array.h:144: note: expected 'real_array_t' but argument is of type 'modelica_real'
arrayFuncBug_functions.c:26: error: incompatible type for argument 3 of 'array_alloc_real_array'
C:/OpenModelica1.9.2Nightly//include/omc/c/util/real_array.h:144: note: expected 'real_array_t' but argument is of type 'double'
arrayFuncBug_functions.c:29: error: incompatible type for argument 3 of 'array_alloc_real_array'
C:/OpenModelica1.9.2Nightly//include/omc/c/util/real_array.h:144: note: expected 'real_array_t' but argument is of type 'double'
Change History
(7)
Component: |
Unknown → Code Generation
|
Owner: |
changed from somebody to Lennart Ochel
|
Cc: |
Mahder Alemseged Gebremedhin added
|
Owner: |
changed from Lennart Ochel to somebody
|
Status: |
new → assigned
|
Owner: |
changed from somebody to Mahder Alemseged Gebremedhin
|
Status: |
assigned → accepted
|
Resolution: |
→ fixed
|
Status: |
accepted → closed
|
Milestone: |
Future → pre1.9.4
|
Milestone: |
pre1.9.4 → 1.9.4
|
Just to let you know, this bug seems to be related to the diagonal function. I've since found that the issue disappears when the matrix is hard-coded.