| 1 |
-- { dg-do run } |
| 2 |
-- { dg-options "-O" } |
| 3 |
|
| 4 |
with Ada.Unchecked_Conversion; |
| 5 |
with Interfaces; use Interfaces; |
| 6 |
with System; use System; |
| 7 |
|
| 8 |
procedure SSO20 is |
| 9 |
|
| 10 |
type Bytes_Ref is array (1 .. 4) of Unsigned_8 |
| 11 |
with Convention => Ada_Pass_By_Reference; |
| 12 |
|
| 13 |
type U32_BE is record |
| 14 |
Value : Unsigned_32; |
| 15 |
end record |
| 16 |
with |
| 17 |
Pack, |
| 18 |
Bit_Order => High_Order_First, |
| 19 |
Scalar_Storage_Order => High_Order_First; |
| 20 |
|
| 21 |
function Conv is new Ada.Unchecked_Conversion (Bytes_Ref, U32_BE); |
| 22 |
|
| 23 |
function Value (B : Bytes_Ref) return Unsigned_32 is (Conv (B).Value); |
| 24 |
|
| 25 |
begin |
| 26 |
if Value ((16#11#, 16#22#, 16#33#, 16#44#)) /= 16#11223344# then |
| 27 |
raise Program_Error; |
| 28 |
end if; |
| 29 |
end; |