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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-stdcheck              |

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #7)
> Hm, I am not actually sure that the code is correct.
> I think I will ask on the J3 mailing list.

Forget the last comment, I was getting confused about the
two 'x' in the test case; this test case fails as well, and should
not:

subroutine acc_attach(x)
  use iso_c_binding, only : c_loc
  implicit none (external, type)

  type(*), dimension(..), target :: x

  interface
    subroutine acc_attach_c(a) bind(C, name="acc_attach")
      use iso_c_binding
      type(c_ptr) :: a
    end subroutine
  end interface

  call acc_attach_c(c_loc(x))
end

which gives

asdf.f90:8:5:

    8 |     subroutine acc_attach_c(a) bind(C, name="acc_attach")
      |     1~~~~~~~~~~~~~~~~~~~~~~
Warning: Interface mismatch in global procedure 'acc_attach_c' at (1): Type
mismatch in argument 'a' (TYPE(c_ptr)/TYPE(*))

It seems that the code checking for the global procedure looks through
the c_loc() call, and it should not.

Reply via email to