Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / whole_file_7.f90
blob53fed228ae29a988502dd74c876d729fb847c35a
1 ! { dg-do compile }
2 ! { dg-options "-fwhole-file" }
3 ! Test the fixes for the first two problems in PR40011
5 ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
7 ! This function would not compile because -fwhole-file would
8 ! try repeatedly to resolve the function because of the self
9 ! reference.
10 RECURSIVE FUNCTION eval_args(q) result (r)
11 INTEGER NNODE
12 PARAMETER (NNODE = 10)
13 TYPE NODE
14 SEQUENCE
15 INTEGER car
16 INTEGER cdr
17 END TYPE NODE
18 TYPE(NODE) heap(NNODE)
19 INTEGER r, q
20 r = eval_args(heap(q)%cdr)
21 END FUNCTION eval_args
23 function test(n)
24 real, dimension(2) :: test
25 integer :: n
26 test = n
27 return
28 end function test
30 program arr ! The error was not picked up causing an ICE
31 real, dimension(2) :: res
32 res = test(2) ! { dg-error "needs an explicit INTERFACE" }
33 print *, res
34 end program