]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | -- Copyright 2019-2024 Free Software Foundation, Inc. |
6c71eb7d TT |
2 | -- |
3 | -- This program is free software; you can redistribute it and/or modify | |
4 | -- it under the terms of the GNU General Public License as published by | |
5 | -- the Free Software Foundation; either version 3 of the License, or | |
6 | -- (at your option) any later version. | |
7 | -- | |
8 | -- This program is distributed in the hope that it will be useful, | |
9 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | -- GNU General Public License for more details. | |
12 | -- | |
13 | -- You should have received a copy of the GNU General Public License | |
14 | -- along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | with System; | |
17 | with Pck; use Pck; | |
18 | ||
e29ff721 | 19 | procedure Unchecked_Union is |
48015786 | 20 | type Key is (Alpha, Beta, Omega); |
6c71eb7d TT |
21 | |
22 | type Inner(Disc : Key := Omega) is record | |
23 | case Disc is | |
24 | when Alpha => | |
25 | Small : Integer range 0..255; | |
48015786 TT |
26 | Second : Integer range 0..255; |
27 | when Beta => | |
28 | Bval : Integer range 0..255; | |
6c71eb7d TT |
29 | when others => |
30 | Large : Integer range 255..510; | |
48015786 | 31 | More : Integer range 255..510; |
6c71eb7d TT |
32 | end case; |
33 | end record; | |
34 | pragma Unchecked_Union (Inner); | |
35 | ||
36 | type Outer(Disc : Key := Alpha) is record | |
37 | case Disc is | |
38 | when Alpha => | |
39 | Field_One : Integer range 0..255; | |
40 | when others => | |
41 | Field_Two : Integer range 255..510; | |
42 | end case; | |
43 | end record; | |
44 | pragma Unchecked_Union (Outer); | |
45 | ||
46 | type Pair is record | |
47 | Pone : Inner; | |
48 | Ptwo : Outer; | |
49 | end record; | |
50 | ||
51 | Value : Pair; | |
52 | ||
53 | begin | |
54 | Do_Nothing (Value'Address); -- BREAK | |
e29ff721 | 55 | end Unchecked_Union; |