2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pointer_init_2.f90
blob8f72663e259b828d6ae316a05a969ab7d2a20b81
1 ! { dg-do compile }
3 ! PR 45290: [F08] pointer initialization
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7 subroutine sub
8 implicit none
10 real, target, save :: r
11 integer, target, save, dimension(1:3) :: v
13 integer, save :: i
14 integer, target :: j
15 integer, target, save, allocatable :: a
18 integer, pointer :: dp0 => 13 ! { dg-error "Error in pointer initialization" }
19 integer, pointer :: dp1 => r ! { dg-error "Different types in pointer assignment" }
20 integer, pointer :: dp2 => v ! { dg-error "Different ranks in pointer assignment" }
21 integer, pointer :: dp3 => i ! { dg-error "is neither TARGET nor POINTER" }
22 integer, pointer :: dp4 => j ! { dg-error "must have the SAVE attribute" }
23 integer, pointer :: dp5 => a ! { dg-error "must not be ALLOCATABLE" }
25 type :: t
26 integer, pointer :: dpc0 => 13 ! { dg-error "Error in pointer initialization" }
27 integer, pointer :: dpc1 => r ! { dg-error "is REAL but should be INTEGER" }
28 integer, pointer :: dpc2 => v ! { dg-error "rank of the element.*does not match" }
29 integer, pointer :: dpc3 => i ! { dg-error "should be a POINTER or a TARGET" }
30 integer, pointer :: dpc4 => j ! { dg-error "must have the SAVE attribute" }
31 integer, pointer :: dpc5 => a ! { dg-error "must not be ALLOCATABLE" }
32 end type
34 type(t) ::u
36 end subroutine