Opened 8 years ago

Closed 3 years ago

#3612 closed defect (fixed)

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

Reported by: martin.otter@… Owned by: lochel
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 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.5

Milestone pushed to 1.9.5

comment:2 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:3 Changed 7 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.11.0

Ticket retargeted after milestone closed

comment:4 Changed 7 years ago by sjoelund.se

  • Milestone changed from 1.11.0 to 1.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:5 Changed 6 years ago by casella

  • Milestone changed from 1.12.0 to Future

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 Changed 3 years ago by perost

  • Milestone changed from Future to 1.16.0
  • Resolution set to fixed
  • Status changed from new to closed

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.