[Patch, Fortran] CLASS handling for assumed-rank arrays
Tobias Burnus
burnus@net-b.de
Tue Jun 26 17:36:00 GMT 2012
This patch assumes that the basic assumed-rank support is included,
http://gcc.gnu.org/ml/fortran/2012-06/msg00144.html
The attached patch implements the support of passing non-assumed-rank
type/class arrays to assumed-rank class/type dummy arguments (type was
working before). And passing assumed-rank class arrays to assumed-rank
class arrays. It does not support passing assumed-rank class arrays to
type arrays.
The problem with the latter is that gfortran uses the TYPE_SIZE_UNIT to
access the array elements, which imlies a copy in/copy out. For
arguments with descriptor, a better choice would be to use the stride
multiplier. (Catch: The current descriptor doesn't have one.) As the
scalarizer doesn't work for assumed-rank arrays, the copy-in/copy-out
fails at run time.
(See also http://j3-fortran.org/pipermail/j3/2012-June/005438.html for
the fun with pointer association when passing a CLASS with TARGET to a
TYPE with TARGET.)
Additionally, I think that this patch makes gfortran the second front
end (after Ada), which uses a range for the assignment: I do not
iterate through for dim, but use a.dim[1:rank] = b.dim[1:rank] in the
assignment. The reason that I have to do a component wise assignment is
that the class container directly contains the descriptor as a component
- not as pointer. Thus, the descriptors can have different ranks...
Build and regtested on x86-64-linux.
OK for the trunk?
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: assumed-rank-class.diff
Type: text/x-patch
Size: 8386 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120626/cd1d891c/attachment.bin>
More information about the Gcc-patches
mailing list