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

function Volatile7 return Integer is

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

   type R is record
      X : Vol := 0;
   end record;

   V : R;

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

   return Integer (V.X);
end;

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