Summary: Full implementation of variable definition contexts
                    (and related checks)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran

Since, there is a new
routine to check definability of variables and pointers in one place
(expr.c:gfc_check_vardef_context).  This should be called from all places
mentioned in the standard as variable definition context (F2008, 16.6.7) and
pointer association context (F2008, 16.6.8).

The pointer association contexts should already be implemented, but not all
variable definition contexts.  Missing are the IO related ones (items 5-10 of
the list in 16.6.7) and the ones related to co-array locks (items 14 and 15). 
These should also be implemented.

For instance, the following invalid program is accepted:

module m
  implicit none

  integer, protected :: a
  character(len=128), protected :: str

end module m

program main
  use :: m
  integer, parameter :: b = 42
  character(len=128) :: myStr

  myStr = '5'

  read(myStr, *) a
  read(myStr, *) b

  write(str, *) 5
end program main

Note that the last line (write to internal PROTECTED variable) was also
accepted before the definability check rework.

Configure bugmail:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Reply via email to