[Patch, fortran-dev] SELECT TYPE execution and allocatable scalar components
Paul Richard Thomas
paul.richard.thomas@gmail.com
Tue Sep 22 13:06:00 GMT 2009
Hi Janus,
The attached is my attempt to build up a derived type actual argument
to match a formal class. I did this in trans-expr.c in the end.
I have also added what I believe to be the cumulative patch to
gcc/fortran in fortran-dev; ie. there are no modifications to the
testsuite.
It seems to do the right thing for scalars :-)
I am unable to check class arrays because something bad is happening
with the referencing of arrays of class objects. Things such as
elemental procedures are going to have to be dealt with too. *sigh*
The next thing that you will have to do within the TYPE IS and CLASS
IS blocks is to implicitly assign the data and the vindex to a hidden
variable which then substitutes the selector within the block.
eg. SELECT TYPE (selector)
TYPE IS (selector_derived1)
{TYPE(selector_derived1) :: $selector.selector_derived1
(arrayspec & attrs of selector }
{$selector.selector_derived1%$data => selector_derived1%$data}
{$selector.selector_derived1%$vindex = selector_derived1%$vindex}
.........rest of block with
$selector.selector_derived1 replacing selector.
where braces denote gfc_code injected in the frontend.
This allows the blocks to access all the components of the local type,
in addition to those of the declared type.
Cheers
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: formal_class.diff
Type: text/x-patch
Size: 1740 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090922/b445187d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: all0922.diff
Type: text/x-patch
Size: 59401 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090922/b445187d/attachment-0001.bin>
More information about the Fortran
mailing list