Opened 11 years ago

Closed 11 years ago

#2376 closed defect (fixed)

Error: incompatible types when assigning to type 'modelica_real' from type 'real_array'

Reported by: adeas31 Owned by: sjoelund.se
Priority: high Milestone: 1.9.1
Component: Frontend Version: trunk
Keywords: Cc:

Description

Simulating the model myShallowRiver.simShallowRiver produces the following error,

Translation	14:40:09		0:0-0:0	Error building simulator. Build log: gcc   -falign-functions -msse2 -mfpmath=sse   -I"C:/OpenModelica/trunk/build//include/omc" -I.   -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o myShallowRiver.simShallowRiver.o myShallowRiver.simShallowRiver.c
myShallowRiver.simShallowRiver.c: In function 'residualFunc259':
myShallowRiver.simShallowRiver.c:2135: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2137: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2142: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2144: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2149: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2151: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2156: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2158: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2163: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2165: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2170: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2172: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2177: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2179: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2184: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2186: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2191: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2193: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2198: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2200: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2205: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2207: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2212: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2214: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2219: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2221: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2226: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2228: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2233: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2235: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2240: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2242: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2247: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2249: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2254: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:2256: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_443':
myShallowRiver.simShallowRiver.c:5574: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5576: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_448':
myShallowRiver.simShallowRiver.c:5641: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5643: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_453':
myShallowRiver.simShallowRiver.c:5708: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5710: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_458':
myShallowRiver.simShallowRiver.c:5775: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5777: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_463':
myShallowRiver.simShallowRiver.c:5842: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5844: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_468':
myShallowRiver.simShallowRiver.c:5909: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5911: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_473':
myShallowRiver.simShallowRiver.c:5976: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:5978: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_478':
myShallowRiver.simShallowRiver.c:6043: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6045: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_483':
myShallowRiver.simShallowRiver.c:6110: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6112: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_488':
myShallowRiver.simShallowRiver.c:6177: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6179: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_493':
myShallowRiver.simShallowRiver.c:6244: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6246: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_498':
myShallowRiver.simShallowRiver.c:6311: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6313: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_503':
myShallowRiver.simShallowRiver.c:6378: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6380: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_508':
myShallowRiver.simShallowRiver.c:6445: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6447: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_513':
myShallowRiver.simShallowRiver.c:6512: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6514: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_518':
myShallowRiver.simShallowRiver.c:6579: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6581: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_525':
myShallowRiver.simShallowRiver.c:6666: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6668: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c: In function 'eqFunction_546':
myShallowRiver.simShallowRiver.c:6895: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
myShallowRiver.simShallowRiver.c:6897: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
mingw32-make: *** [myShallowRiver.simShallowRiver.o] Error 1

Attachments (1)

myShallowRiver.mo (7.2 KB) - added by adeas31 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by adeas31

comment:1 Changed 11 years ago by sjoelund.se

  • Milestone changed from 1.9.0 to 1.9.1

Postponed until 1.9.1

comment:2 Changed 11 years ago by sjoelund.se

  • Owner changed from lochel to sjoelund.se
  • Status changed from new to assigned

This is due to code being generated saying h[1] has type Real[18]. Which is weird because of two things:

  • It should be a scalar since it is a subscripted array
  • h has type Real[19]

comment:3 Changed 11 years ago by sjoelund.se

  • Component changed from Code Generation to Frontend

Smaller model that shows the same problem:

model M
  parameter Real th = 0;
  parameter Integer NVd = 2;
  Real h[NVd+1];
equation
  h[3] = 1.0;
  ones(NVd) = cos(th)*h[1:end-1];
end M;

comment:4 Changed 11 years ago by sjoelund.se

  • Resolution set to fixed
  • Status changed from assigned to closed

See r18693 for the fix (simplification of array cref+slice)

Note: See TracTickets for help on using tickets.