Opened 6 years ago

Last modified 3 years ago

#5389 assigned defect

Creation of Complex array fails

Reported by: dariomangoni@… Owned by: Karim Adbdelhak
Priority: high Milestone:
Component: Code Generation Version: v1.14.0-dev-nightly
Keywords: complex Cc:

Description

Creating an array of Complex fails.
I think I'm not doing anything wrong (Dymola compiles!)

model complexArray
  Complex compl_arr_not_working[1];
  Complex compl_working;
  Complex compl_arr_working[1] = {Complex(1.0)}; // this DOES work
algorithm
  compl_arr_not_working := {Complex(1.0)}; // this does NOT work
  compl_working := Complex(1.0); // this DOES work
end complexArray;

Change History (7)

comment:1 by dariomangoni@…, 6 years ago

This is the output I get:

C:/OpenModelica//share/omc/scripts/Compile.bat complexArray gcc mingw64 parallel 8 0
PATH = "C:\OpenModelica\tools\msys\mingw64\bin;C:\OpenModelica\tools\msys\mingw64\bin\..\..\usr\bin;"
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray.o complexArray.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_functions.o complexArray_functions.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_records.o complexArray_records.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_01exo.o complexArray_01exo.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_02nls.o complexArray_02nls.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_03lsy.o complexArray_03lsy.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_04set.o complexArray_04set.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_05evt.o complexArray_05evt.c
gcc  -Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse     -I"C:/OpenModelica//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=complexArray -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o complexArray_06inz.o complexArray_06inz.c
complexArray.c: In function 'complexArray_eqFunction_4':
complexArray.c:108:3: warning: implicit declaration of function 'Complex_array_create' [-Wimplicit-function-declaration]
   Complex_array_create(&tmp2, ((modelica_Complex*)&((&$Pcompl_arr_not_working)[calc_base_index_dims_subs(1, 1, ((modelica_integer) 1))])), 1, 1);
   ^
complexArray.c:108:33: error: 'modelica_Complex' undeclared (first use in this function)
   Complex_array_create(&tmp2, ((modelica_Complex*)&((&$Pcompl_arr_not_working)[calc_base_index_dims_subs(1, 1, ((modelica_integer) 1))])), 1, 1);
                                 ^
complexArray.c:108:33: note: each undeclared identifier is reported only once for each function it appears in
complexArray.c:108:50: error: expected expression before ')' token
   Complex_array_create(&tmp2, ((modelica_Complex*)&((&$Pcompl_arr_not_working)[calc_base_index_dims_subs(1, 1, ((modelica_integer) 1))])), 1, 1);
                                                  ^
complexArray.c:109:3: warning: implicit declaration of function 'copy_Complex_array_data' [-Wimplicit-function-declaration]
   copy_Complex_array_data(tmp0, &tmp2);
   ^
<builtin>: recipe for target 'complexArray.o' failed
\tools\msys\mingw64\bin\mingw32-make: *** [complexArray.o] Error 1
\tools\msys\mingw64\bin\mingw32-make: *** Waiting for unfinished jobs....
complexArray_06inz.c: In function 'complexArray_eqFunction_3':
complexArray_06inz.c:70:3: warning: implicit declaration of function 'Complex_array_create' [-Wimplicit-function-declaration]
   Complex_array_create(&tmp2, ((modelica_Complex*)&((&$Pcompl_arr_not_working)[calc_base_index_dims_subs(1, 1, ((modelica_integer) 1))])), 1, 1);
   ^
complexArray_06inz.c:70:33: error: 'modelica_Complex' undeclared (first use in this function)
   Complex_array_create(&tmp2, ((modelica_Complex*)&((&$Pcompl_arr_not_working)[calc_base_index_dims_subs(1, 1, ((modelica_integer) 1))])), 1, 1);
                                 ^
complexArray_06inz.c:70:33: note: each undeclared identifier is reported only once for each function it appears in
complexArray_06inz.c:70:50: error: expected expression before ')' token
   Complex_array_create(&tmp2, ((modelica_Complex*)&((&$Pcompl_arr_not_working)[calc_base_index_dims_subs(1, 1, ((modelica_integer) 1))])), 1, 1);
                                                  ^
complexArray_06inz.c:71:3: warning: implicit declaration of function 'copy_Complex_array_data' [-Wimplicit-function-declaration]
   copy_Complex_array_data(tmp0, &tmp2);
   ^
<builtin>: recipe for target 'complexArray_06inz.o' failed
\tools\msys\mingw64\bin\mingw32-make: *** [complexArray_06inz.o] Error 1
Compilation process failed. Exited with code 2.

comment:2 by Francesco Casella, 6 years ago

Milestone: Future1.14.0
Owner: changed from Lennart Ochel to Karim Adbdelhak
Status: newassigned

comment:3 by Martin Sjölund, 6 years ago

Note though, the following works:

function t
protected
  Complex c[1];
algorithm
  c := {Complex(1.0)};
end t;

comment:4 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:5 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:6 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:7 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.