annotate gcc/testsuite/gfortran.dg/intent_out_2.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! Tests the fix for PR33554, in which the default initialization
kono
parents:
diff changeset
3 ! of temp, in construct_temp, caused a segfault because it was
kono
parents:
diff changeset
4 ! being done before the array offset and lower bound were
kono
parents:
diff changeset
5 ! available.
kono
parents:
diff changeset
6 !
kono
parents:
diff changeset
7 ! Contributed by Harald Anlauf <anlauf@gmx.de>
kono
parents:
diff changeset
8 !
kono
parents:
diff changeset
9 module gfcbug72
kono
parents:
diff changeset
10 implicit none
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 type t_datum
kono
parents:
diff changeset
13 character(len=8) :: mn = 'abcdefgh'
kono
parents:
diff changeset
14 end type t_datum
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 type t_temp
kono
parents:
diff changeset
17 type(t_datum) :: p
kono
parents:
diff changeset
18 end type t_temp
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 contains
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 subroutine setup ()
kono
parents:
diff changeset
23 integer :: i
kono
parents:
diff changeset
24 type (t_temp), pointer :: temp(:) => NULL ()
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 do i=1,2
kono
parents:
diff changeset
27 allocate (temp (2))
kono
parents:
diff changeset
28 call construct_temp (temp)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 if (any (temp % p% mn .ne. 'ijklmnop')) STOP 1
111
kono
parents:
diff changeset
30 deallocate (temp)
kono
parents:
diff changeset
31 end do
kono
parents:
diff changeset
32 end subroutine setup
kono
parents:
diff changeset
33 !--
kono
parents:
diff changeset
34 subroutine construct_temp (temp)
kono
parents:
diff changeset
35 type (t_temp), intent(out) :: temp (:)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
36 if (any (temp % p% mn .ne. 'abcdefgh')) STOP 2
111
kono
parents:
diff changeset
37 temp(:)% p% mn = 'ijklmnop'
kono
parents:
diff changeset
38 end subroutine construct_temp
kono
parents:
diff changeset
39 end module gfcbug72
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 program test
kono
parents:
diff changeset
42 use gfcbug72
kono
parents:
diff changeset
43 implicit none
kono
parents:
diff changeset
44 call setup ()
kono
parents:
diff changeset
45 end program test