RISC-V: Add support for riscv-*-*.
[official-gcc.git] / gcc / testsuite / gnat.dg / boolean_bitfield.adb
blob5909f7c4a079bdf2b0b2dec487597e595acfd47c
1 -- { dg-do run }
2 -- { dg-options "-O" }
4 with System; use System;
6 procedure Boolean_Bitfield is
8 Units_Per_Integer : constant :=
9 (Integer'Size + System.Storage_Unit - 1) / System.Storage_Unit;
11 type E_type is (Red, Blue, Green);
13 type Parent_Type is record
14 I : Integer range 0 .. 127 := 127;
15 C : Character := 'S';
16 B : Boolean := False;
17 E : E_Type := Blue;
18 end record;
20 for Parent_Type use record
21 C at 0 * Units_Per_Integer range 0 .. Character'Size - 1;
22 B at 1 * Units_Per_Integer range 0 .. Boolean'Size - 1;
23 I at 2 * Units_Per_Integer range 0 .. Integer'Size/2 - 1;
24 E at 3 * Units_Per_Integer range 0 .. Character'Size - 1;
25 end record;
27 type Derived_Type is new Parent_Type;
29 for Derived_Type use record
30 C at 1 * Units_Per_Integer range 1 .. Character'Size + 1;
31 B at 3 * Units_Per_Integer range 1 .. Boolean'Size + 1;
32 I at 5 * Units_Per_Integer range 1 .. Integer'Size/2 + 1;
33 E at 7 * Units_Per_Integer range 1 .. Character'Size + 1;
34 end record;
36 Rec : Derived_Type;
38 begin
39 Rec := (12, 'T', True, Red);
41 if (Rec.I /= 12) or (Rec.C /= 'T') or (not Rec.B) or (Rec.E /= Red) then
42 raise Program_Error;
43 end if;
44 end;