(j3.2006) Question about zero-sized array.
Daniel C Chen
Tue Jun 20 11:14:55 EDT 2017
The standard specifies, "Zero-sized arrays and zero-length strings are
It also says "Allocation of a zero-sized array or zero-length character
variable causes the array or variable to become defined"
Question1: Does it have initial value at all?
Question2: Can it appear as the LHS of an assignment?
Question3: Can it be used in an expression and have a defined result?
Please consider the following example:
real, dimension(:,:), allocatable :: a
real, dimension(:), allocatable :: x,y
a(:,:) = 0.0 !Q2: Is this legal? What is the value of a?
x(:) = 0.0
y(:) = 1.0
y(:) = MATMUL( a(:,:), x(:) ) !Q3: Is this legal? what is the value of y?
end program test
real :: a(7,0)
real :: x(0),y(7)
a = 0.0 !Q2: is this legal? What is the value of a?
x = 0.0
y = 1.0
y = MATMUL( a, x ) !Q3: is this legal? what is the value of y?
end program test2
XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Email: cdchen at ca.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3