Inlining with mixed C/Fortran code

Inlining with mixed C/Fortran code

I am having trouble with inlining when using a mixed C and Fortran 2008 code. The optimization report states:

-> (25,9) testfun(int64_t *, const int64_t, double *) (isz = 18) (sz = 27)
    [[ Unable to inline callsite  <1>]]
-> (27,9) testfunptr(int64_t *, const int64_t, double *) (isz = 18) (sz = 27)
    [[ Unable to inline callsite  <1>]]
<1> Inlining the subprogram will lead to incorrect program behavior.

Why does the compiler state that inlining will lead to incorrect behavior?

The C functions have the following signatures:

void testfun( int64_t *a, const int64_t b, double *c );

void testfunptr( int64_t *a, const int64_t b, double *c );

The Fortran code provides explicit interfaces to these functions:

   interface
      subroutine testfun( a, b, c ) bind( C, name = 'testfun' )
         use, intrinsic :: iso_c_binding, only: c_int64_t, c_double
         implicit none
         integer( kind = c_int64_t ), dimension( * ), intent( inout ) :: a
         integer( kind = c_int64_t ), value, intent( in ) :: b
         real( kind = c_double ), dimension( * ), intent( inout ) :: c
      end subroutine testfun

      subroutine testfunptr( a, b, c ) bind( C, name = 'testfunptr' )
         use, intrinsic :: iso_c_binding, only: c_int64_t, c_ptr
         implicit none
         type( c_ptr ), value :: a
         integer( kind = c_int64_t ), value, intent( in ) :: b
         type( c_ptr ), value :: c
      end subroutine testfunptr
   end interface
AdjuntoTamaño
Descargarapplication/x-tar test_code.tar10 KB
publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

I had a similar issue.  I opened a support ticket (02522591) which was closed without explanation.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya