PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / used_dummy_types_8.f90
blob84233841c811bf0b1b040b3c8a89f18a49044d4e
1 ! { dg-do compile }
2 ! Tests the fix for PR30880, in which the variable d1
3 ! in module m1 would cause an error in the main program
4 ! because it has an initializer and is a dummy. This
5 ! came about because the function with multiple entries
6 ! assigns the initializer earlier than for other cases.
8 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
10 MODULE M1
11 TYPE T1
12 INTEGER :: i=7
13 END TYPE T1
14 CONTAINS
15 FUNCTION F1(d1) RESULT(res)
16 INTEGER :: res
17 TYPE(T1), INTENT(OUT) :: d1
18 TYPE(T1), INTENT(INOUT) :: d2
19 res=d1%i
20 d1%i=0
21 RETURN
22 ENTRY E1(d2) RESULT(res)
23 res=d2%i
24 d2%i=0
25 END FUNCTION F1
26 END MODULE M1
28 USE M1
29 TYPE(T1) :: D1
30 D1=T1(3)
31 write(6,*) F1(D1)
32 D1=T1(3)
33 write(6,*) E1(D1)
34 END