view gcc/testsuite/gfortran.dg/pointer_init_3.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
!
! PR 45290: [F08] pointer initialization
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

module m
 integer, target  :: t1          ! SAVE is implicit
 integer, pointer :: p1 => t1
end module m


use m
implicit none

integer,target :: i0 = 2
integer,target,dimension(1:3) :: vec = 1

type :: t
  integer, pointer :: dpc => i0
  integer :: i = 0
end type

type (t), save, target :: u

integer, pointer :: dp => i0
integer, pointer :: dp2 => vec(2)
integer, pointer :: dp3 => u%i

dp = 5
if (i0/=5) STOP 1

u%dpc = 6
if (i0/=6) STOP 2

dp2 = 3
if (vec(2)/=3) STOP 3

dp3 = 4
if (u%i/=4) STOP 4

end