﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4212	Wrong code generation for function calls involving cross product and MultiBody.Frames.Rotation records	Francesco Casella	Martin Sjölund	"Consider the following test model:
{{{
model TestCrossFunction
  import Modelica.Mechanics.MultiBody.Frames;
  Frames.Orientation R = Frames.nullRotation();
  Real v1[3], v2[3];

  function f
    input Frames.Orientation R;
    input Real v1[3];
    output Real v2[3];
  algorithm
    v2 :=  Frames.resolveRelative(cross(Frames.angularVelocity2(R), v1), R, R);
  end f;
  
equation
  v1 = {0, 0, 0};
  v2 = f(R, v1);
end TestCrossFunction;
}}}

When building the model, the C compiler complains that
{{{
TestCrossFunction_functions.c: In function 'omc_TestCrossFunction_f':
TestCrossFunction_functions.c:143:26: error: lvalue required as unary '&' operand
   cross_alloc_real_array(&omc_Modelica_Mechanics_MultiBody_Frames_angularVelocity2(threadData, _R), &tmp1, &tmp2);
}}}

Apparently some part of the code generation algorithm assumes that the first argument of the C implementation of the {{{cross()}}} function is a variable and not the result of a function call, so it incorrectly tries to to get its address."	defect	closed	high	1.12.0	Code Generation		fixed		
