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

function Volatile6 return Integer is

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

  V : Vol := 0;

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

  return Integer (V);
end;

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