diff options
author | Daniel Kraft <d@domob.eu> | 2010-09-25 16:27:20 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2010-09-25 16:27:20 +0200 |
commit | 8e8dc0603560c94f84c0061f3040d8f2654f8036 (patch) | |
tree | 545accb9fd475dcf562501179762b5ef130d655c /gcc/fortran/resolve.c | |
parent | c21136eebbf57975d027b64730703553fcbc1b09 (diff) | |
download | gcc-8e8dc0603560c94f84c0061f3040d8f2654f8036.zip gcc-8e8dc0603560c94f84c0061f3040d8f2654f8036.tar.gz gcc-8e8dc0603560c94f84c0061f3040d8f2654f8036.tar.bz2 |
re PR fortran/45776 (Full implementation of variable definition contexts (and related checks))
2010-09-25 Daniel Kraft <d@domob.eu>
PR fortran/45776
* gfortran.h (struct gfc_dt): New member `dt_io_kind'.
* io.c (resolve_tag): F2008 check for NEWUNIT and variable
definition checks for NEWUNIT, IOSTAT, SIZE and IOMSG.
(gfc_free_dt): Correctly handle freeing of `dt_io_kind' and
`extra_comma' with changed semantics.
(gfc_resolve_dt): Check variable definitions.
(match_io_element): Remove INTENT and PURE checks here and
initialize code->ext.dt member.
(match_io): Set dt->dt_io_kind.
(gfc_resolve_inquire): Check variable definition for all tags
except UNIT, FILE and ID.
* resolve.c (resolve_transfer): Variable definition check.
2010-09-25 Daniel Kraft <d@domob.eu>
PR fortran/45776
* gfortran.dg/io_constraints_6.f03: New test.
* gfortran.dg/io_constraints_7.f03: New test.
* gfortran.dg/newunit_2.f90: New test.
From-SVN: r164619
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 30ca7ce..0dce3f8 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7916,6 +7916,13 @@ resolve_transfer (gfc_code *code) && exp->expr_type != EXPR_FUNCTION)) return; + /* If we are reading, the variable will be changed. Note that + code->ext.dt may be NULL if the TRANSFER is related to + an INQUIRE statement -- but in this case, we are not reading, either. */ + if (code->ext.dt && code->ext.dt->dt_io_kind->value.iokind == M_READ + && gfc_check_vardef_context (exp, false, _("item in READ")) == FAILURE) + return; + sym = exp->symtree->n.sym; ts = &sym->ts; |