PR target/84336
[official-gcc.git] / gcc / testsuite / gnat.dg / unchecked_convert7.adb
blob502459bba7b852c3dd486284b0d05561ce597716
1 -- { dg-do compile }
2 -- { dg-options "-g -gnatVa" }
4 with Unchecked_Conversion;
6 procedure Unchecked_Convert7 is
8 type BPA is array (1 .. 23) of Boolean;
9 pragma Pack (BPA);
10 for BPA'Size use 23;
12 subtype Byte is Natural range 0 .. 255;
14 type R is
15 record
16 S : Boolean;
17 E : Byte;
18 F : BPA;
19 end record;
21 for R use
22 record
23 S at 0 range 0 .. 0;
24 E at 0 range 1 .. 8;
25 F at 0 range 9 .. 31;
26 end record;
27 for R'Size use 32;
29 function Conversion
30 is new Unchecked_Conversion (Source => R, Target => Float);
32 F : Float := Conversion (R'(False, Byte'Last, (others => False)));
34 begin
35 null;
36 end;