Opened 13 years ago

Last modified 7 years ago

#1680 closed defect

Error in generated C code for arrays with undetermined size — at Initial Version

Reported by: chenouard-r Owned by: chenouard-r
Priority: high Milestone:
Component: Code Generation Version:
Keywords: Cc: chenouard-r

Description

I build a "simple" example with a model and a function based on an array of an undetermined size. I think I conformed to Modelica language, but some other Modelica compilers also don't achieve in executing this code (mainly a problem with my use of sum function). The modelica code and 2 of the main C files generated by OpenModelica are joined as attached files. I use OpenModelica Compiler 1.8.0 (r10946).

I got the following errors when compiling:
{{{Test.Test1.c: In function ‘eqFunction_3’:
Test.Test1.c:279: error: expected expression before ‘:’ token
Test.Test1.c:289: error: ‘$P$reductionFoldTmpA’ undeclared (first use in this function)
Test.Test1.c:289: error: (Each undeclared identifier is reported only once
Test.Test1.c:289: error: for each function it appears in.)
Test.Test1.c:289: error: ‘$P$reductionFoldTmpB’ undeclared (first use in this function)
Test.Test1.c: In function ‘eqFunction_6’:
Test.Test1.c:385: error: expected expression before ‘:’ token
Test.Test1.c:395: error: ‘$P$reductionFoldTmpA’ undeclared (first use in this function)
Test.Test1.c:395: error: ‘$P$reductionFoldTmpB’ undeclared (first use in this function)}}}

I suppose there is a problem when reformulating and generating the C code. The ':' symbol is used to state C arrays and some temporary variables are not define before use.

Change History (2)

by chenouard-r, 13 years ago

Attachment: test.mo added

by chenouard-r, 13 years ago

Attachment: _Test.Test1.h added
Note: See TracTickets for help on using tickets.