https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122245

            Bug ID: 122245
           Summary: -fc-prototypes does not work with interfaces defined
                    by a PROCEDURE statement
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

While working on pr122206:

module m
  use, intrinsic :: iso_c_binding, only: c_double, c_int
  implicit none

  abstract interface
     function simple_interface(iarg1, arg2) bind(c) result(res)
       import c_double, c_int
       integer(c_int), intent(in) :: iarg1
       real(c_double), intent(in) :: arg2
       real(c_double) :: res
     end function simple_interface
  end interface

  procedure(simple_interface), bind(c,name="simple_function") ::
simple_function

  interface
     function other_function(iarg1, arg2) bind(c,name="other_function")
result(res)
       import c_double, c_int
       integer(c_int), value, intent(in) :: iarg1
       real(c_double), value, intent(in) :: arg2
       real(c_double) :: res
     end function other_function
  end interface
end


% gfc-16 interfaces.f90 -c -fc-prototypes | grep '^double '
double other_function (int iarg1, double arg2);
double simple_function ();

So the prototype for simple_function is wrong.

Reply via email to