[Patch, Fortran] SELECT TYPE with associate-name
Janus Weil
janus@gcc.gnu.org
Mon Oct 5 12:07:00 GMT 2009
Hi all,
here is a patch that implements a small enhancement for the SELECT
TYPE construct, namely using an associate-name, as in:
SELECT TYPE ( x => ... )
The dots can be any CLASS-valued expression here, which makes it
possible to use arbitrary expressions as a selector, and not only
named variables.
What I do to accomplish this is basically: Use the associate-name 'x'
like an ordinary variable, except that it gets its type from the
selector expression, and insert an additional operation in front of
the SELECT block which does the assignment "x => ...".
The patch works fine on the attached test case and also makes
Salvatore's PSBLAS compile. It was regtested on
x86_64-unknown-linux-gnu with no failures.
Ok for trunk?
Cheers,
Janus
2009-10-05 Janus Weil <janus@gcc.gnu.org>
* expr.c (gfc_check_pointer_assign): Do the correct type checking when
CLASS variables are involved.
* match.c (gfc_match_select_type): Parse associate-name in SELECT TYPE
statements.
* resolve.c (resolve_select_type): Insert assignment for the selector
variable, in case an associate-name is given.
(resolve_code): Only call gfc_check_pointer_assign for non-CLASS
assignments.
2009-10-05 Janus Weil <janus@gcc.gnu.org>
* gfortran.dg/select_type_4.f03: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: select_type_1005.diff
Type: text/x-diff
Size: 4421 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091005/ba474b28/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: select_type_4.f03
Type: application/octet-stream
Size: 637 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091005/ba474b28/attachment.obj>
More information about the Fortran
mailing list