2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / volatile5.f90
blob42607a1e63edad87a9d7d3f909955dc87f8c0aea
1 ! { dg-do compile }
2 ! { dg-options "-O3 -fdump-tree-optimized" }
3 ! Tests whether volatile really works with modules
4 ! PR fortran/29601
5 module volmod
6 implicit none
7 integer, volatile :: a
8 logical :: b,c
9 volatile :: b
10 contains
11 subroutine sample
12 a = 33.
13 if(a /= 432) print *,'aPresent'
15 b = .false.
16 if(b) print *,'bPresent'
18 c = .false.
19 if(c) print *,'cPresent'
20 end subroutine sample
21 end module volmod
23 program main
24 use volmod
25 implicit none
27 a = 432
28 if(a /= 432) print *,'aStillPresent'
30 b = .false.
31 if(b) print *,'bStillPresent'
33 c = .false.
34 if(c) print *,'cStillPresent'
35 end program main
36 ! { dg-final { scan-tree-dump "aPresent" "optimized" } }
37 ! { dg-final { scan-tree-dump "bPresent" "optimized" } }
38 ! { dg-final { scan-tree-dump "aStillPresent" "optimized" } }
39 ! { dg-final { scan-tree-dump "bStillPresent" "optimized" } }
40 ! { dg-final { scan-tree-dump-not "cPresent" "optimized" } }
41 ! { dg-final { scan-tree-dump-not "cStillPresent" "optimized" } }
42 ! { dg-final { cleanup-tree-dump "optimized" } }
43 ! { dg-final { cleanup-modules "volmod" } }