1-- { dg-do compile }
2
3package Clause_On_Volatile is
4
5  type U8 is mod 2 ** 8;
6
7  type Word is record
8     A, B : U8;
9  end record;
10  For Word'Alignment use 4;
11
12  type Vword is new Word;
13  For Vword'Alignment use 4;
14  pragma Volatile (Vword);
15
16  type Aword is new Word;
17  For Aword'Alignment use 4;
18  pragma Atomic (Aword);
19
20  type R1 is record
21     W : Word;
22  end record;
23  for R1 use record
24     W at 0 range 0 .. 15; -- OK
25  end record;
26
27  type A1 is record
28     AW : Aword;
29  end record;
30  For A1'Alignment use 4;
31  for A1 use record
32     AW at 0 range 0 .. 15; -- { dg-error "must be \[0-9\]*" }
33  end record;
34
35  type A2 is record
36     B : U8;
37     AW : Aword;
38  end record;
39  For A2'Alignment use 4;
40  for A2 use record
41     B at 0 range 0 .. 7;
42     AW at 1 range 0 .. 31; -- { dg-error "must be multiple" }
43  end record;
44
45  type A3 is record
46     B : U8;
47     AW : Aword;
48  end record;
49  For A3'Alignment use 4;
50  for A3 use record
51     B at 0 range 0 .. 7;
52     AW at 1 range 0 .. 15; -- { dg-error "must be (multiple||\[0-9\]*)" }
53  end record;
54
55  type V1 is record
56     VW : Vword;
57  end record;
58  For V1'Alignment use 4;
59  for V1 use record
60     VW at 0 range 0 .. 15;
61  end record;
62
63  type V2 is record
64     B : U8;
65     VW : Vword;
66  end record;
67  For V2'Alignment use 4;
68  for V2 use record
69     B at 0 range 0 .. 7;
70     VW at 1 range 0 .. 31;
71  end record;
72
73  type V3 is record
74     B : U8;
75     VW : Vword;
76  end record;
77  For V3'Alignment use 4;
78  for V3 use record
79     B at 0 range 0 .. 7;
80     VW at 1 range 0 .. 15;
81  end record;
82
83end Clause_On_Volatile;
84