Debian Codegraph @

gcc/testsuite/gnat.dg/opt26.adb

raw
1 -- { dg-do run }
2 -- { dg-options "-gnato -O" }
3
4 with Interfaces; use Interfaces;
5
6 procedure Opt26 is
7
8 procedure Shift_Left_Bool
9 (Bool : in Boolean;
10 U8 : out Interfaces.Unsigned_8)
11 is
12 begin
13 U8 := Shift_Left (Boolean'Pos (Bool), 6);
14 end Shift_Left_Bool;
15
16 procedure Shift_Left_Not_Bool
17 (Bool : in Boolean;
18 U8 : out Interfaces.Unsigned_8)
19 is
20 begin
21 U8 := Shift_Left (Boolean'Pos (not Bool), 6);
22 end Shift_Left_Not_Bool;
23
24 Bool : constant Boolean := True;
25 Byte1, Byte2 : Interfaces.Unsigned_8;
26
27 begin
28
29 Shift_Left_Bool (Bool, Byte1);
30
31 Shift_Left_Not_Bool (Bool, Byte2);
32
33 if Byte1 + Byte2 /= 64 then
34 raise Program_Error;
35 end if;
36
37 end;