Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / volatile6.f90
blobe42e3de3acbb1ab36b9e7b4178d533991eaadeb8
1 ! { dg-do compile }
2 ! { dg-options "-O2 -fdump-tree-optimized" }
3 ! Tests whether volatile really works for arrays
4 ! PR fortran/29601
5 logical, allocatable, volatile :: t1(:)
6 logical, allocatable :: t2(:)
7 integer :: i
9 allocate(t1(1),t2(1))
10 t1 = .false.
11 t2 = .false.
12 do i = 1, 2
13 if(ubound(t1,1) /= 1) print *, 'VolatileNotOptimizedAway1'
14 if(ubound(t2,1) /= 1) print *, 'NonVolatileNotOptimizedAway1'
15 end do
17 t1 = .false.
18 if(t1(1)) print *, 'VolatileNotOptimizedAway2'
19 t2 = .false.
20 if(t2(1)) print *, 'NonVolatileNotOptimizedAway2'
21 end
22 ! { dg-final { scan-tree-dump "VolatileNotOptimizedAway1" "optimized" } }
23 ! { dg-final { scan-tree-dump "VolatileNotOptimizedAway2" "optimized" } }
24 ! { dg-final { scan-tree-dump-not "NonVolatileNotOptimizedAway1" "optimized" } }
25 ! { dg-final { scan-tree-dump-not "NonVolatileNotOptimizedAway2" "optimized" } }
26 ! { dg-final { cleanup-tree-dump "optimized" } }