summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/volatile8.adb
blob: 83f7488580e2bc17edb66419d263b9f12260a279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- { dg-do compile }
-- { dg-options "-O2 -fdump-tree-optimized" }

function Volatile8 return Integer is

   type Vol is new Integer;
   pragma Volatile (Vol);

   type A is array (1..4) of Vol;

   V : A := (others => 0);

begin
   for J in 1 .. 10 loop
      V(1) := V(1) + 1;
   end loop;

   return Integer (V(1));
end;

-- { dg-final { scan-tree-dump "goto" "optimized" } }
-- { dg-final { cleanup-tree-dump "optimized" } }