Debian Codegraph @

gcc/testsuite/gnat.dg/opt92.adb

raw
1 -- { dg-do compile { target { lp64 || llp64 } } }
2 -- { dg-options "-O2 -gnatws" }
3
4 procedure Main is
5
6 subtype Int64 is Long_Long_Integer;
7
8 type Arr is array (Int64 range <>) of Boolean;
9
10 Pow : constant := 10;
11
12 procedure Compute (B : in out Arr) is
13 Factor : Int64 := 3;
14 Num : Int64;
15 begin
16 while Factor <= 10 ** (Pow / 2) loop
17 Num := Factor;
18 while Num < 10 ** Pow loop
19 if B (Num) then
20 Factor := Num;
21 exit;
22 end if;
23 Num := Num + 2;
24 end loop;
25 Num := Factor * Factor;
26 while Num < 10 ** Pow loop
27 B (Num) := False;
28 Num := Num + Factor * 2;
29 end loop;
30 Factor := Factor + 2;
31 end loop;
32 end;
33
34 B : Arr (1 .. 10 ** Pow) := (others => True);
35
36 begin
37 Compute (B);
38 end;