OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gnat.dg/] [warn4.adb] - Blame information for rev 328

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 304 jeremybenn
-- { dg-do compile }
2
-- { dg-options "-O2" }
3
 
4
with Unchecked_Conversion;
5
 
6
procedure Warn4 is
7
 
8
   type POSIX_Character is new Standard.Character;
9
   type POSIX_String is array (Positive range <>) of aliased POSIX_Character;
10
 
11
   type String_Ptr is access all String;
12
   type POSIX_String_Ptr is access all POSIX_String;
13
 
14
   function sptr_to_psptr is new Unchecked_Conversion -- { dg-warning "aliasing problem" }
15
     (String_Ptr, POSIX_String_Ptr); -- { dg-warning "" "" { target *-*-* } 14 }
16
 
17
   function To_POSIX_String (Str : String) return POSIX_String;
18
   function To_POSIX_String (Str : String)
19
      return POSIX_String is
20
   begin
21
      return sptr_to_psptr (Str'Unrestricted_Access).all;
22
   end To_POSIX_String;
23
 
24
   A : Boolean;
25
   S : String := "ABCD/abcd";
26
   P : Posix_String := "ABCD/abcd";
27
 
28
begin
29
   A := To_POSIX_String (S) = P;
30
end;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.