Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#3198 closed defect (fixed)

ParModelica fails to build model calling print due to invalid conversion

Reported by: Gustaf Thorslund Owned by: Mahder Alemseged Gebremedhin
Priority: high Milestone: 1.9.4
Component: ParModelica Version: trunk
Keywords: ParModelica Cc:

Description

Given the following model:

model PrintTest
algorithm
  when sample(0, 0.1) then
    print ("Time: " + String(time) + "\n");
  end when;
end PrintTest;

Try to build it with ParModelica:

$ omc -s -g=ParModelica PrintTest.mo 
class PrintTest
algorithm
  when sample(0.0, 0.1) then
    print("Time: " + String(time, 0, true, 6) + "
    ");
  end when;
end PrintTest;

Then compilation fails with:

$ make -f PrintTest.makefile 
g++   -fPIC -O0 -falign-functions -march=native     -I"/home/gustaf/local/openmodelica/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o PrintTest.o PrintTest.c
In file included from /home/gustaf/local/openmodelica/include/omc/c/openmodelica_func.h:44:0,
                 from PrintTest.c:5:
/home/gustaf/local/openmodelica/include/omc/c/simulation_data.h:48:71: error: invalid conversion from ‘const void*’ to ‘modelica_string {aka void*}’ [-fpermissive]
 #define omc_dummyRealAttribute {"","","",DBL_MAX,DBL_MIN,0,0,1.0,0,0.0}
                                                                       ^
PrintTest_12jac.h:2:51: note: in expansion of macro ‘omc_dummyRealAttribute’
 static const REAL_ATTRIBUTE dummyREAL_ATTRIBUTE = omc_dummyRealAttribute;
                                                   ^
/home/gustaf/local/openmodelica/include/omc/c/simulation_data.h:48:71: error: invalid conversion from ‘const void*’ to ‘modelica_string {aka void*}’ [-fpermissive]
 #define omc_dummyRealAttribute {"","","",DBL_MAX,DBL_MIN,0,0,1.0,0,0.0}
                                                                       ^
PrintTest_12jac.h:2:51: note: in expansion of macro ‘omc_dummyRealAttribute’
 static const REAL_ATTRIBUTE dummyREAL_ATTRIBUTE = omc_dummyRealAttribute;
                                                   ^
/home/gustaf/local/openmodelica/include/omc/c/simulation_data.h:48:71: error: invalid conversion from ‘const void*’ to ‘modelica_string {aka void*}’ [-fpermissive]
 #define omc_dummyRealAttribute {"","","",DBL_MAX,DBL_MIN,0,0,1.0,0,0.0}
                                                                       ^
PrintTest_12jac.h:2:51: note: in expansion of macro ‘omc_dummyRealAttribute’
 static const REAL_ATTRIBUTE dummyREAL_ATTRIBUTE = omc_dummyRealAttribute;
                                                   ^
<builtin>: recipe for target 'PrintTest.o' failed
make: *** [PrintTest.o] Error 1

$ omc --version
1.9.2+dev (r24991)

Change History (5)

comment:1 by Per Östlund, 10 years ago

Component: FrontendParModelica
Owner: changed from somebody to Mahder Alemseged Gebremedhin

Seems we didn't have a ParModelica component in Trac before. Fixed :)

comment:2 by Mahder Alemseged Gebremedhin, 9 years ago

Resolution: fixed
Status: newclosed

comment:3 by Dietmar Winkler, 9 years ago

Milestone: Future1.9.4

Sorting these closed tickets away from "Future". Since they were closed after the last 1.9.3 release, it's very likely that they should have been part of the 1.9.4 release.

comment:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:5 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.