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

            Bug ID: 110993
           Summary: Possibly bogus diagnostic on renamed interface import
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rimvydas.jas at gmail dot com
  Target Milestone: ---

Spotted while checking why someone was manually mangling names with bind(c).
$ cat foo.f90
module intfb_pack
  interface
!    subroutine bar(x) bind(c, name="bar_") ! does not warn
!    subroutine bar(x) bind(c, name="bar") ! Error: More actual than formal
arguments in procedure call
    subroutine bar(x) ! Warning: Shape mismatch in argument 'x'
      use iso_c_binding, only : c_float
      implicit none
      real(c_float) :: x(45)
    end subroutine
  end interface
end module

subroutine foo(x)
  use intfb_pack, notthisone => bar
  implicit none
  real :: x(3)
  call bar(x)
end subroutine

$ gfortran -c foo.f90
foo.f90:17:13:

   14 |   use intfb_pack, notthisone => bar
      |      2
......
   17 |   call bar(x)
      |             1
Warning: Shape mismatch in argument 'x' between (1) and (2)

The diagnostic is a bit surprising given that selective import with "use
intfb_pack, only:" does not emit diagnostics.  Moreover, the "bind(c,
name="bar")" case hard error seems very wrong.

Reply via email to