2 -- { dg-options "-O2" }
4 with Unchecked_Conversion
;
8 type POSIX_Character
is new Standard
.Character;
9 type POSIX_String
is array (Positive range <>) of aliased POSIX_Character
;
11 type String_Ptr
is access all String;
12 type POSIX_String_Ptr
is access all POSIX_String
;
14 function sptr_to_psptr
is new Unchecked_Conversion
-- { dg-warning "aliasing problem" }
15 (String_Ptr
, POSIX_String_Ptr
); -- { dg-warning "" "" { target *-*-* } 14 }
17 function To_POSIX_String
(Str
: String) return POSIX_String
;
18 function To_POSIX_String
(Str
: String)
19 return POSIX_String
is
21 return sptr_to_psptr
(Str
'Unrestricted_Access).all;
25 S
: String := "ABCD/abcd";
26 P
: Posix_String
:= "ABCD/abcd";
29 A
:= To_POSIX_String
(S
) = P
;