(j3.2006) C-Interop question about establishing the bounds

Daniel C Chen cdchen
Fri Feb 6 15:36:52 EST 2015


Please consider the following code:

      Program main
          subroutine sub(c_arg) bind(c)
            integer n                   !! Local auto var
            character(*) :: c_arg(n,5)
          end subroutine
        end interface
        character(3) :: ccc(10)
        call sub(ccc)
      end program

1. Is the program standard conforming?
2. If it is legal, what would be the rank of the effective argument that is
passed to sub?
3. If it is legal, what would be the ubound of the effecive argument?

I found the following statement [99:5-9,].

"An explicit-shape array that is a named local variable of
a subprogram or BLOCK construct may have bounds that are not
constant expressions. The bounds, and hence shape, are
determined on entry to a procedure defined by the subprogram,
or on execution of the BLOCK statement, by evaluating
the bounds? expressions."

Does it mean in order to determine the bounds of c_arg on entry to sub,
'n' must be a dummy argument itself since 'n' may not be defined at the
Entry to sub if it is automatic variable?

How does it apply to the BLOCK statement?



XL Fortran Development - IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20150206/a5cf8eaa/attachment.html 

More information about the J3 mailing list