﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3612	Wrong C-code for Modelica.Math.FastFourierTransform.Examples.RealFFT1	martin.otter@…	Lennart Ochel	"In MSL trunk, I have changed  Modelica.Math.FastFourierTransform.Examples.RealFFT1 so that the model translates in OpenModelica. However, the generated C-code is wrong. Error message from OpenModelica:
{{{
Modelica.Math.FastFourierTransform.Examples.RealFFT1_functions.c: In function 'omc_Modelica_Math_FastFourierTransform_Internal_rawRealFFT':
Modelica.Math.FastFourierTransform.Examples.RealFFT1_functions.c:104: error: '_work' undeclared (first use in this function)
Modelica.Math.FastFourierTransform.Examples.RealFFT1_functions.c:104: error: (Each undeclared identifier is reported only once
Modelica.Math.FastFourierTransform.Examples.RealFFT1_functions.c:104: error: for each function it appears in.)
}}}
The function calls an external C-function with a work array:
{{{
function rawRealFFT 
  input Real  u[:] ;
  output Integer info ;
  output Real amplitudes[div(size(u,1),2)+1];
  output Real phases[    div(size(u,1),2)+1];
protected 
  Real work[3*size(u,1) + 2*(div(size(u,1),2)+1)];
  external ""C"" info = ModelicaFFT_kiss_fftr(u, size(u,1), work, size(work,1), amplitudes, phases)
}}}
and the protected ""work"" seems to be ""somehow"" not included in the C-code (a similar structure appears for Modelica.Math.Matrices.* when LAPACK functions are called."	defect	closed	high	1.16.0	Code Generation		fixed		
