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

Jerry DeLisle jvdelisle@frontier.com
Sat Sep 25 07:07:00 GMT 2010


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.  No need to add the
io_kind transfer_io_kind I think

match
gfc_match_read (void)
{
   return match_io (M_READ);
}


match
gfc_match_write (void)
{
   return match_io (M_WRITE);
}

Also gfc_exec_op in gfc_code has these:

   EXEC_OPEN, EXEC_CLOSE, EXEC_WAIT,
   EXEC_READ, EXEC_WRITE, EXEC_IOLENGTH, EXEC_TRANSFER, EXEC_DT_END,

which are set by the matchers so in resolution you should be able to just test 
for code->op == EXEC_READ for example.

I would prefer you use these structures unless I am missing something.

Cheers,

Jerry



More information about the Gcc-patches mailing list