[Patch, Fortran] PR fortran/45776: More variable definition checks

Mikael Morin mikael.morin@sfr.fr
Sat Sep 25 08:38:00 GMT 2010


On Friday 24 September 2010 21:02:13 Jerry DeLisle wrote:
> On 09/24/2010 09:36 AM, Daniel Kraft wrote:
> > Hi,
> > 
> > the attached patch implements the missing IO related variable definition
> > checks (which is now PR 45776). Except the LOCK/UNLOCK cases which can
> > not yet be implemented because locks are not yet in gfortran, the full
> > list of variable definition contexts of F2008, 16.6.7 should be
> > implemented with that.
> > 
> > It fixes some accepts-invalid cases that my last patch created, but also
> > adds some checks that were missing before it. As a bonus, it adds a
> > F2008 check when using NEWUNIT (which was missing before).
> > 
> > As I'm not really familiar with the IO related data-structures, I left
> > two XXX comments in the patch asking for possible better solutions (when
> > they exist), please take a look at them.
> 
> The io_kind is set explicitly at higher level in the matchers.
Are you sure it is? 

io.c:3671 has:
      /* Save the iokind and locus for later use in resolution.  */
      dt->extra_comma = gfc_get_iokind_expr (&gfc_current_locus, k);

According to the comment, it is non-trivial to get the io kind at resolution 
stage. 

> 
> match
> gfc_match_read (void)
> {
>    return match_io (M_READ);
> }
> 
> 
> match
> gfc_match_write (void)
> {
>    return match_io (M_WRITE);
> }

It seems io_kind (M_READ or M_WRITE) is not saved by match_io in the io 
structures.
By the way, grepping for io_kind reveals that there is a io_kind member in the 
gfc_expr struct only. Having one in gfc_dt (or one of the io structs) instead  
makes more sense. 

This is just my (not so humble) opinion. 

Mikael



More information about the Gcc-patches mailing list