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

Robert Corbett rpcorbett at att.net
Mon Oct 7 16:53:47 EDT 2019

How does it fail?

Was the C descriptor initialized by CFI_establish and then passed changed to the interoperable subroutine, or was the C descriptor changed after it was established?

Bob Corbett

> On Oct 7, 2019, at 11:09 AM, Vipul Parekh via J3 <j3 at mailman.j3-fortran.org> wrote:
> 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