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

Vipul Parekh parekhvs at gmail.com
Mon Oct 7 14:09:50 EDT 2019

Is the following code conforming?

   subroutine sub(foo) bind(C, name="foo")
      !.. Argument list
      integer(c_int), allocatable, intent(out) :: foo
      foo = 42  !<-- fails
      !allocate( foo ); foo = 42  !<-- works
   end subroutine

When foo is invoked from a companion C processor with a successfully
established C descriptor with the right attributes, the use of
ALLOCATE statement followed by the assignment works as I expect.
However allocation upon assignment, as shown above, fails.

Thank you,
Vipul Parekh

More information about the J3 mailing list