Opened 9 years ago

Closed 4 years ago

#3612 closed defect (fixed)

Wrong C-code for Modelica.Math.FastFourierTransform.Examples.RealFFT1

Reported by: martin.otter@… Owned by: Lennart Ochel
Priority: high Milestone: 1.16.0
Component: Code Generation Version:
Keywords: Cc:

Description

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.

Change History (6)

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

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

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

Milestone: 1.9.51.10.0

Milestone renamed

comment:3 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

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

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:5 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

comment:6 by Per Östlund, 4 years ago

Milestone: Future1.16.0
Resolution: fixed
Status: newclosed

The code generation issue seems to have been fixed since the model now simulates. There's still some issue with not getting the correct result, but I guess that's covered by #5855.

Note: See TracTickets for help on using tickets.