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

--- Comment #5 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #4)
> What is unclear to me: when is an expression interoperable?
> Or rather when is it *not*?
> 
> (Note that the standard text has not essentially changed since F2008,
> so we got this too strict from the beginning.)

Actually the following interp is very helpful:

https://j3-fortran.org/doc/year/22/22-101r1.txt

And while working on a fix, I found the following invalid code ICEing:

subroutine s ()
  use, intrinsic :: iso_c_binding
  implicit none
  type(c_ptr) :: cPtr
  call c_f_pointer (cPtr, p0)            ! { dg-error "function returning a
pointer" }
  call c_f_pointer (cPtr, p1, shape=[2]) ! { dg-error "function returning a
pointer" }
contains
  function p0 ()
    integer, pointer :: p0
    nullify (p0)
  end
  function p1 ()
    integer, pointer :: p1(:)
    nullify (p1)
  end
end

Reply via email to