Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / volatile11.f90
blob079e9163c26698bd104323be95651b7be632fa6d
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)
6 subroutine wait1
7 logical event
8 volatile event
9 common /dd/ event
10 event = .false.
12 if (event) print *, 'NotOptimizedAway1'
13 end do
14 end subroutine
16 subroutine wait2
17 logical event, foo
18 volatile event
19 equivalence (event, foo)
20 event = .false.
22 if (event) print *, 'NotOptimizedAway2'
23 end do
24 end subroutine
26 subroutine wait3
27 logical event
28 integer foo
29 volatile foo
30 equivalence (event, foo)
31 event = .false.
33 if (event) print *, 'IsOptimizedAway'
34 end do
35 end subroutine
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" } } */