OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / pointer_component_type_1.f90
1 ! { dg-do compile }
2 ! This checks the fix for PR20889 in wrong pointer types in derived
3 ! type constructors would either give no message or would segfault.
4 !
5 ! Contributed by Joost VandVondele  <jv244@cam.ac.uk>
6 !==============
7   TYPE TEST
8     REAL, POINTER :: A
9   END TYPE
10
11   TYPE TEST1
12     REAL :: A
13   END TYPE
14
15   INTEGER, POINTER :: IP
16   real, POINTER :: RP
17   TYPE(TEST) :: DD
18   TYPE(TEST1) :: EE
19 ! Next line is the original => gave no warning/error.
20   DD=TEST(NULL(IP))    ! { dg-error "INTEGER but should be REAL" }
21 ! Would segfault here.
22   DD=TEST(IP)          ! { dg-error "INTEGER but should be REAL" }
23 ! Check right target type is OK.
24   DD=TEST(NULL(RP))
25 ! Check non-pointer is OK.
26   EE= TEST1(1)
27 ! Test attempted conversion from character to real.
28   EE= TEST1("e")       ! { dg-error "convert CHARACTER" }
29 END