Opened 14 years ago

Last modified 14 years ago

#1257 closed defect (fixed)

Codegen bug

Reported by: jlettau Owned by: jlettau
Priority: critical Milestone:
Component: Version:
Keywords: Cc: jlettau,

Description

Hello,

in the attachment is a *.mo file (block_test.mo), the omc generated makefile (mod.makefile) caused the following error output:

mod.cpp: In function int functionDAE_output2()': \\mod.cpp:528: error: cannot convert double*' to modelica_integer*' for argument 2' to void integer_array_create(integer_array_t*, modelica_integer*, int, ...)' \\mod.cpp:529: error: cannot convert double*' to modelica_integer*' for argument 2' to void integer_array_create(integer_array_t*, modelica_integer*, int, ...)' \\mod.cpp:532: error: expected primary-expression before "struct" \\mod.cpp:532: error: expected )' before "struct"
mod.cpp:535: error: expected primary-expression before "struct"
mod.cpp:535: error: expected )' before "struct" \\mod.cpp: In function int function_updateDependents()':
mod.cpp:675: error: cannot convert double*' to modelica_integer*' for argument 2' to void integer_array_create(integer_array_t*, modelica_integer*, int, ...)'
mod.cpp:676: error: cannot convert double*' to modelica_integer*' for argument 2' to void integer_array_create(integer_array_t*, modelica_integer*, int, ...)'
mod.cpp:679: error: expected primary-expression before "struct"
mod.cpp:679: error: expected )' before "struct" \\mod.cpp:682: error: expected primary-expression before "struct" \\mod.cpp:682: error: expected )' before "struct"
mod.cpp: In function int function_updateDepend()': \\mod.cpp:719: error: cannot convert double*' to modelica_integer*' for argument 2' to void integer_array_create(integer_array_t*, modelica_integer*, int, ...)' \\mod.cpp:720: error: cannot convert double*' to modelica_integer*' for argument 2' to void integer_array_create(integer_array_t*, modelica_integer*, int, ...)' \\mod.cpp:723: error: expected primary-expression before "struct" \\mod.cpp:723: error: expected )' before "struct"
mod.cpp:726: error: expected primary-expression before "struct"
mod.cpp:726: error: expected `)' before "struct"
make.exe": * [mod] Error 1

{{{block foo

input Integer foo1[:];
input Integer foo2[:];
output Real result[size(foo1,1)];

algorithm

for i in 1:size(foo1,1) loop

if foo1[i] >= foo2[i] then

result[i] := 7.0;

else

result[i] := 8.0;

end if;

end for;

end foo;

model mod

parameter Integer mod1[:]={1,1,1};
parameter Integer mod2[:]={2,0,0};
Real result[size(mod1,1)];
foo f1(foo1=mod1, foo2=mod2);
equation

result = f1.result;

end mod;}}}

Attachments (1)

block_test.mo (466 bytes ) - added by jlettau 14 years ago.

Download all attachments as: .zip

Change History (3)

by jlettau, 14 years ago

Attachment: block_test.mo added

comment:1 by Martin Sjölund, 14 years ago

The problem with casting real/int array is now gone since integers were introduced to the runtime.

The problem seems to be that result[i] := 7.0; has type ET_COMPLEX.

comment:2 by Martin Sjölund, 14 years ago

This is been fixed in OM 1.6.0. The fix was probably around the same time we changed integer arrays from being represented as double* to int*.

Note: See TracTickets for help on using tickets.