summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/volatile4.adb
blob: fe2b30760ce606941a29f86d7381c98b073a57f8 (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 run }

procedure Volatile4 is

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

  type Rec is record
    I : My_Int;
  end record;

  function F (R : Rec) return Rec is
  begin
    return R;
  end;

  R : Rec := (I => 0);

begin
  R := F (R);
  if R.I /= 0 then
    raise Program_Error;
  end if;
end;