Opened 5 years ago
Last modified 5 years ago
#5616 new defect
Handling of indexing in arrays of records
Reported by: | Adrian Pop | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | critical | Milestone: | 2.0.0 |
Component: | Code Generation | Version: | |
Keywords: | Cc: |
Description
See also: https://openmodelica.org/forum/default-topic/2772-problem-while-iterating-on-records
Build Test22 has issues:
package Structure2 record TestRecord2 Real Tc[2]; end TestRecord2; function Suma input Real tc[2]; output Real a; algorithm a:=tc[1]+tc[2]; end Suma; model RecordTestBase2 constant TestRecord2 test1(Tc={5.0,50.0}); constant TestRecord2 test2(Tc={10.0,100.0}); constant TestRecord2 test[2] = {test1,test2}; Real A; end RecordTestBase2; model Test21 extends RecordTestBase2; algorithm A:=0.0; for i in 1:2 loop A:=A+test[i].Tc[1]+test[i].Tc[2]; end for; end Test21; model Test22 extends RecordTestBase2; algorithm A:=0.0; for i in 1:2 loop A:=A+Suma(test[i].Tc); end for; end Test22; end Structure2;
"[CodegenCFunctions.tpl:6583:13-6583:13:writable] Error: Template error: ASUB non-scalar {{5.0, 50.0}, {10.0, 100.0}}[i]. The inner exp has type: Real[2, 2]. After ASUB it is still an array: Real[2].. [C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/SimCode/SimCodeMain.mo:471:7-471:78:writable] Error: Internal error C:\home\adrpo33\dev\OpenModelica\build\bin\omc.exe: [unknown function name] failed [CodegenCFunctions.tpl:6583:13-6583:13:writable] Error: Template error: ASUB non-scalar {{5.0, 50.0}, {10.0, 100.0}}[i]. The inner exp has type: Real[2, 2]. After ASUB it is still an array: Real[2].. [C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/SimCode/SimCodeMain.mo:471:7-471:78:writable] Error: Internal error C:\home\adrpo33\dev\OpenModelica\build\bin\omc.exe: [unknown function name] failed
Note:
See TracTickets
for help on using tickets.