Background The declare directive is used to allocate device memory for the entire scope of a variable / array within a program, function, or subroutine. Consider the following example. module vars integer b !$acc declare device_resident (b) integer c !$acc declare link (c) end module vars program main use vars integer, parameter :: N = 8 integer :: a(N) a(:) = 2 c = 12 !$acc parallel copy (a) present (b) copyin(c) do i = 1, N b = a(i) c = b a(i) = c + i end do !$acc end parallel end program In the example, 'b' will be allocated on the device at the outset of device activity and be available for the duration. Whereas the allocation of 'c' will be delayed until the parallel region is entered. The device memory for 'c' will be deallocated upon exit of the parallel region. Fortran front-end The changes are concentrated into four (4) areas. 1) module support The neccesary functionality has been added to handle the reading in and writing out of the appropriate attributes for the declare directive. Additional functionality has been added at read in time to setup the required declare handling. 2) device_resident and link clauses Add the functionality necessary to process the link and device_resident clauses. 3) clause checking The clause checking has been cleaned up to better check for duplicates and correctness. 4) directive generation Prior to handling the fortran execution body a code body is created to handle the clause(s) that accompany the declare directive(s). Each clause is examined and determined whether the clause need to be modified to perform an action at the beginning of the module, function, subroutine, or program. Furthermore, an additional clause may be added to the list to perform an action at the time the function or subroutine returns. Once all the clauses have been handled, the code body is added to the chain. libgomp TODO Testing New compile and runtime tests have been added. Also some have been modified.