| 1 |
-- { dg-do run { target i?86-*-* x86_64-*-* alpha*-*-* ia64-*-* } } |
| 2 |
-- { dg-options "-O2" } |
| 3 |
|
| 4 |
with Ada.Characters.Handling; use Ada.Characters.Handling; |
| 5 |
with Interfaces; use Interfaces; |
| 6 |
with Ada.Unchecked_Conversion; |
| 7 |
|
| 8 |
procedure Opt47 is |
| 9 |
|
| 10 |
subtype String4 is String (1 .. 4); |
| 11 |
function To_String4 is new Ada.Unchecked_Conversion (Unsigned_32, String4); |
| 12 |
type Arr is array (Integer range <>) of Unsigned_32; |
| 13 |
Leaf : Arr (1 .. 4) := (1349478766, 1948272498, 1702436946, 1702061409); |
| 14 |
Value : Unsigned_32; |
| 15 |
Result : String (1 .. 32); |
| 16 |
Last : Integer := 0; |
| 17 |
|
| 18 |
begin |
| 19 |
for I in 1 .. 4 loop |
| 20 |
Value := Leaf (I); |
| 21 |
for J in reverse String4'Range loop |
| 22 |
if Is_Graphic (To_String4 (Value)(J)) then |
| 23 |
Last := Last + 1; |
| 24 |
Result (Last) := To_String4 (Value)(J); |
| 25 |
end if; |
| 26 |
end loop; |
| 27 |
end loop; |
| 28 |
if Result (1) /= 'P' then |
| 29 |
raise Program_Error; |
| 30 |
end if; |
| 31 |
end; |