aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/pointer_component_type_1.f90
blob: b3a4086aff662eb41ec2c207e8211c286dd819a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
! { dg-do compile }
! This checks the fix for PR20889 in wrong pointer types in derived
! type constructors would either give no message or would segfault.
!
! Contributed by Joost VandVondele  <jv244@cam.ac.uk>
!==============
  TYPE TEST
    REAL, POINTER :: A
  END TYPE

  TYPE TEST1
    REAL :: A
  END TYPE

  INTEGER, POINTER :: IP
  real, POINTER :: RP
  TYPE(TEST) :: DD
  TYPE(TEST1) :: EE
! Next line is the original => gave no warning/error.
  DD=TEST(NULL(IP))    ! { dg-error "INTEGER but should be REAL" }
! Would segfault here.
  DD=TEST(IP)          ! { dg-error "INTEGER but should be REAL" }
! Check right target type is OK.
  DD=TEST(NULL(RP))
! Check non-pointer is OK.
  EE= TEST1(1)
! Test attempted conversion from character to real.
  EE= TEST1("e")       ! { dg-error "convert CHARACTER" }
END