| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-std=f2003 -fdump-tree-original" } |
| 3 |
! |
| 4 |
! Covers code introduced by the fix to PR fortran/87923. |
| 5 |
! The idea is that the variables in a namelist or I/O list used for |
| 6 |
! asynchronous I/O will be marked with the asynchronous attribute. |
| 7 |
! |
| 8 |
! At this time, "asynchronous" is treated as "volatile" (see trans-decl.c). |
| 9 |
! Thus, every variable referenced in an "asynchronous=yes" I/O list |
| 10 |
! should obtain the "volatile" specifier in its declaration. |
| 11 |
! |
| 12 |
|
| 13 |
implicit none |
| 14 |
|
| 15 |
type t |
| 16 |
character(4) :: comp_async |
| 17 |
end type |
| 18 |
|
| 19 |
type(t) :: dvar_async |
| 20 |
integer :: ivar_async |
| 21 |
real :: rvar_async |
| 22 |
logical :: lvar_async |
| 23 |
integer :: ivar_noasync |
| 24 |
|
| 25 |
namelist /names/ ivar_async, rvar_async, lvar_async |
| 26 |
|
| 27 |
open(1, asynchronous="yes") |
| 28 |
write(1, asynchronous="yes") dvar_async |
| 29 |
write(1, asynchronous="yes") dvar_async%comp_async |
| 30 |
read(1, asynchronous="yes", nml=names) |
| 31 |
|
| 32 |
open(2, asynchronous="no") |
| 33 |
read(2, asynchronous="no") ivar_noasync |
| 34 |
|
| 35 |
end |
| 36 |
|
| 37 |
! { dg-final { scan-tree-dump "volatile +struct +\[^ \]+ +dvar_async" "original" } } |
| 38 |
! { dg-final { scan-tree-dump "volatile +\[^ \]+ +ivar_async" "original" } } |
| 39 |
! { dg-final { scan-tree-dump "volatile +\[^ \]+ +rvar_async" "original" } } |
| 40 |
! { dg-final { scan-tree-dump "volatile +\[^ \]+ +lvar_async" "original" } } |
| 41 |
! { dg-final { scan-tree-dump-not "volatile +\[^ \]+ +ivar_noasync" "original" } } |