OSDN Git Service

2011-09-26 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / volatile11.f90
1 ! { dg-do compile }
2 ! { dg-options "-O2 -fdump-tree-optimized" }
3 ! Tests that volatile can be applied to members of common blocks or
4 ! equivalence groups (PR fortran/35037)
5 !
6 subroutine wait1
7   logical event
8   volatile event
9   common /dd/ event
10   event = .false.
11   do
12     if (event) print *, 'NotOptimizedAway1'
13   end do
14 end subroutine
15
16 subroutine wait2
17   logical event, foo
18   volatile event
19   equivalence (event, foo)
20   event = .false.
21   do
22     if (event) print *, 'NotOptimizedAway2'
23   end do
24 end subroutine
25
26 subroutine wait3
27   logical event
28   integer foo
29   volatile foo
30   equivalence (event, foo)
31   event = .false.
32   do
33     if (event) print *, 'IsOptimizedAway'
34   end do
35 end subroutine
36
37 ! { dg-final { scan-tree-dump "NotOptimizedAway1" "optimized" } } */
38 ! { dg-final { scan-tree-dump "NotOptimizedAway2" "optimized" } } */
39 ! { dg-final { scan-tree-dump-not "IsOptimizedAway" "optimized" } } */
40 ! { dg-final { cleanup-tree-dump "optimized" } } */