1-- { dg-do compile }
2
3package Atomic3 is
4
5   type Four_Bits is mod 2**4;
6   type Fourteen_Bits is mod 2**14;
7   type Twenty_Eight_Bits is mod 2**28;
8
9   type Rec1 (Mode : Boolean := True) is record
10      Reserved : Four_Bits;
11      case Mode is
12         when True =>
13           High_Part : Fourteen_Bits;
14           Low_Part  : Fourteen_Bits;
15         when False =>
16           Data : Twenty_Eight_Bits;
17      end case;
18   end record;
19   for Rec1 use record
20      Reserved  at 0 range 28 .. 31;
21      High_Part at 0 range 14 .. 27;
22      Low_Part  at 0 range  0 .. 13;
23      Data      at 0 range  0 .. 27;
24   end record;
25   for Rec1'Size use 32;
26   pragma Unchecked_Union (Rec1);
27
28   type Rec2 is record
29      A : Rec1;
30      pragma Atomic (A);
31   end record;
32
33end Atomic3;
34