OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / volatile5.f90
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'
14
15     b = .false.
16     if(b) print *,'bPresent'
17
18     c = .false.
19     if(c) print *,'cPresent'
20   end subroutine sample
21 end module volmod
22
23 program main
24   use volmod
25   implicit none
26
27   a = 432
28   if(a /= 432) print *,'aStillPresent'
29
30   b = .false.
31   if(b)        print *,'bStillPresent'
32
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" } }