﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4545	Code generation for algorithms involving arrays broken in commit 453e1c7	Francesco Casella	Willi Braun	"Please consider the {{{MWE.Loop_alg}}} and {{{MWE_2017_10_06.Test_vector}}} models in the two attachments. They ran fine with [https://github.com/OpenModelica/OMCompiler/commit/453e1c7703d431ff5ec065b9da3d2baf52f37901 453e1c7] and were broken in [https://github.com/OpenModelica/OMCompiler/commit/da38b3e64f226adbe5b1d811992b0b25c9e0e19f da38b3e]. In all likelyood, the latest commit is to blame, as the other ones in between seem hardly relevant.

The first example gives these warnings during code generation
{{{
[1] 09:49:38 Translation Error
Internal error checkAndGetAlgorithmOutputs failed.

[2] 09:49:38 Translation Error
[/build/openmodelica-TEh4Jb/openmodelica-1.13.0~dev-129-g52108c7
/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 6248:7-6248:88]: 
Internal error function createSingleAlgorithmCode failed

[3] 09:49:38 Translation Error
[/build/openmodelica-TEh4Jb/openmodelica-1.13.0~dev-129-g52108c7
/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 4758:9-4758:135]: 
Internal error Generation of symbolic matrix SimCode
(SimCode.createSymbolicJacobianssSimCode) failed

[4] 09:49:38 Translation Error
[/build/openmodelica-TEh4Jb/openmodelica-1.13.0~dev-129-g52108c7
/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 592:5-592:146]: 
Internal error function createSimCode failed [Transformation from 
optimised DAE to simulation code structure failed]
}}}

while the second generates the C code but then fails during compilation:

{{{
MWE_2017_10_06.Test_vector_13opt.c
MWE_2017_10_06.Test_vector_12jac.c:220:11: error: use of undeclared identifier '$Pu$Pi$P$pDERC$PdummyVarC'
          $Pu$Pi$P$pDERC$PdummyVarC = (-$Py$Pi$P$pDERC$PdummyVarC);
          ^
MWE_2017_10_06.Test_vector_12jac.c:220:41: error: use of undeclared identifier '$Py$Pi$P$pDERC$PdummyVarC'
          $Pu$Pi$P$pDERC$PdummyVarC = (-$Py$Pi$P$pDERC$PdummyVarC);
                                        ^
MWE_2017_10_06.Test_vector_12jac.c:363:11: error: use of undeclared identifier '$Pu$Pi$P$pDERB$PdummyVarB'
          $Pu$Pi$P$pDERB$PdummyVarB = (-$Py$Pi$P$pDERB$PdummyVarB);
          ^
MWE_2017_10_06.Test_vector_12jac.c:363:41: error: use of undeclared identifier '$Py$Pi$P$pDERB$PdummyVarB'
          $Pu$Pi$P$pDERB$PdummyVarB = (-$Py$Pi$P$pDERB$PdummyVarB);
                                        ^
MWE_2017_10_06.Test_vector_12jac.c:506:11: error: use of undeclared identifier '$Pu$Pi$P$pDERA$PdummyVarA'
          $Pu$Pi$P$pDERA$PdummyVarA = (-$Py$Pi$P$pDERA$PdummyVarA);
          ^
MWE_2017_10_06.Test_vector_12jac.c:506:41: error: use of undeclared identifier '$Py$Pi$P$pDERA$PdummyVarA'
          $Pu$Pi$P$pDERA$PdummyVarA = (-$Py$Pi$P$pDERA$PdummyVarA);
                                        ^
6 errors generated.
<builtin>: recipe for target 'MWE_2017_10_06.Test_vector_12jac.o' failed
make: *** [MWE_2017_10_06.Test_vector_12jac.o] Error 1
make: *** Waiting for unfinished jobs....
Compilation process failed. Exited with code 2.
}}}

Please make sure that these test cases work again ASAP. As I understand there are preciously few test cases with algorithms in the testsuite, I would also suggest to add them to it, to avoid similar problems in the future."	defect	closed	blocker	1.13.0	Code Generation		fixed		albertoleva
