Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Inlining with mixed C/Fortran code

p_j_o
Beginner
321 Views

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
0 Kudos
1 Reply
dkokron
Beginner
321 Views

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

0 Kudos
Reply