Opened 16 years ago

Last modified 14 years ago

#1090 closed defect (fixed)

Code generation of identity() fails in a function .

Reported by: rruusu Owned by: rruusu
Priority: high Milestone:
Component: Version:
Keywords: Cc: rruusu,

Description

The model below produces an internal error:

function returnArray
  output Real[3,3] o;
algorithm
  o := identity(3);
end returnArray;

model Test
  Real[3,3] array;
equation
  array = returnArray();
end Test;

Result of omc +s:

fclass Test
Real array[1,1];
Real array[1,2];
Real array[1,3];
Real array[2,1];
Real array[2,2];
Real array[2,3];
Real array[3,1];
Real array[3,2];
Real array[3,3];
equation
  array = returnArray();
end Test;
Error processing file: ArrayFunctionTest4.mo
Internal error code  generation of expression CAST(/tp:REAL[3, 3]/, identity(3))
 failed
Internal error Code generation of Modelica functions failed.

# Error encountered! Exiting...
# Please check the error message and the flags.

Execution failed!

There is no problem when {{identity}} is used in an equation. The error does not occur if {{identity(3)}} is replaced with {{zeros(3,3)}}.

Change History (1)

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

Fixed in trunk

Note: See TracTickets for help on using tickets.