xref: /netbsd-src/external/gpl3/gdb/dist/gdb/testsuite/gdb.ada/arrayptr/foo.adb (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1--  Copyright 2008-2013 Free Software Foundation, Inc.
2--
3--  This program is free software; you can redistribute it and/or modify
4--  it under the terms of the GNU General Public License as published by
5--  the Free Software Foundation; either version 3 of the License, or
6--  (at your option) any later version.
7--
8--  This program is distributed in the hope that it will be useful,
9--  but WITHOUT ANY WARRANTY; without even the implied warranty of
10--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11--  GNU General Public License for more details.
12--
13--  You should have received a copy of the GNU General Public License
14--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16with Pck; use Pck;
17
18procedure Foo is
19   type String_Access is access String;
20
21   String_P : String_Access := new String'("Hello");
22   Null_String : String_Access := null;
23
24   --  Same situation, but constrained array.
25   type Little_Array is array (1 .. 10) of Integer;
26   type Little_Array_Ptr is access all Little_Array;
27   Arr_Ptr: Little_Array_Ptr :=
28     new Little_Array'(21, 22, 23, 24, 25, 26, 27, 28, 29, 30);
29begin
30   Do_Nothing (String_P'Address);  -- STOP
31   Do_Nothing (Null_String'Address);
32   Do_Nothing (Arr_Ptr'Address);
33end Foo;
34