Debian Codegraph @

gcc/testsuite/gnat.dg/boolean_subtype1.adb

raw
1 -- { dg-do compile }
2 -- { dg-options "-O2" }
3
4 procedure Boolean_Subtype1 is
5
6 subtype Component_T is Boolean;
7
8 function Condition return Boolean is
9 begin
10 return True;
11 end;
12
13 V : Integer := 0;
14
15 function Component_Value return Integer is
16 begin
17 V := V + 1;
18 return V;
19 end;
20
21 Most_Significant : Component_T := False;
22 Least_Significant : Component_T := True;
23
24 begin
25
26 if Condition then
27 Most_Significant := True;
28 end if;
29
30 if Condition then
31 Least_Significant := Component_T'Val (Component_Value);
32 end if;
33
34 if Least_Significant < Most_Significant then
35 Least_Significant := Most_Significant;
36 end if;
37
38 if Least_Significant /= True then
39 raise Program_Error;
40 end if;
41
42 end;