[J3] Allocatation upon assignment of a dummy argument in an interoperable procedure

Vipul Parekh parekhvs at gmail.com
Mon Oct 7 23:32:38 EDT 2019


Thank you Malcolm.  I did check to make sure the compiler options
covered standard conformance, particularly with allocation on
assignment.

Another question: does the following conform to the current standard?

--- begin code ----
module m
   use, intrinsic :: iso_c_binding, only : c_int
contains
   subroutine Fsub( dat ) bind(C, name="Fsub")
      !.. Argument list
      integer(c_int), allocatable, intent(out) :: dat
      dat = 42
      return
   end subroutine
end module m
   use, intrinsic :: iso_c_binding, only : c_int
   use m, only : Fsub
   integer(c_int), allocatable :: x
   call Fsub( x )
   print *, "x = ", x, "; expected is 42"
end
--- end code ---

I ask because this case also fails while my understanding is the above
is supported by the enhanced interoperability facility in Fortran
2018.

Thanks,
Vipul


On Mon, Oct 7, 2019 at 8:20 PM Malcolm Cohen via J3
<j3 at mailman.j3-fortran.org> wrote:
>
> You might need an option to make the compiler standard-conforming. Some compilers, at least in the past, did not do (re)allocation on assignment without such an option.


More information about the J3 mailing list