Debian Codegraph @

gcc/testsuite/gfortran.dg/pr114535d.f90

raw
1 ! { dg-do compile }
2 ! { dg-compile-aux-modules "pr114535iv.f90" }
3 ! Contributed by Andrew Benson <[email protected]>
4 !
5 module d
6 implicit none
7 contains
8 function en() result(dd)
9 use :: iv
10 implicit none
11 type(vs) :: dd
12 dd%i = 1
13 end function en
14 end module d
15
16 ! Delete line 1 and all brands complain that 'vs' is an undefined type.
17 ! Delete lines 1 and line 2 recreates the original problem.
18 module ni
19 implicit none
20 contains
21 subroutine iss1()
22 ! use :: iv ! line 1
23 use :: d
24 implicit none
25 ! type(vs) :: ans; ans = en(); ! line 2
26 end subroutine iss1
27 subroutine iss2()
28 use :: d
29 implicit none
30 end subroutine iss2
31 end module ni ! Used to give an ICE: in gfc_trans_call, at fortran/trans-stmt.cc:400
32
33 use ni
34 use iv
35 type(vs) :: x
36 call iss1()
37 call iss1()
38 if ((ctr .eq. 0) .or. (ctr .ne. 6)) stop 1 ! Depends whether lines 1 & 2 are present
39 call iss2()
40 x = vs(42)
41 if ((ctr .eq. 1) .or. (ctr .ne. 7)) stop 2 ! Make sure destructor available here
42 end