Debian Codegraph @

gcc/testsuite/gfortran.dg/whole_file_7.f90

raw
1 ! { dg-do compile }
2 ! Test the fixes for the first two problems in PR40011
3 !
4 ! Contributed by Dominique d'Humieres <[email protected]>
5 !
6 ! This function would not compile because -fwhole-file would
7 ! try repeatedly to resolve the function because of the self
8 ! reference.
9 RECURSIVE FUNCTION eval_args(q) result (r)
10 INTEGER NNODE
11 PARAMETER (NNODE = 10)
12 TYPE NODE
13 SEQUENCE
14 INTEGER car
15 INTEGER cdr
16 END TYPE NODE
17 TYPE(NODE) heap(NNODE)
18 INTEGER r, q
19 r = eval_args(heap(q)%cdr)
20 END FUNCTION eval_args
21
22 function test(n)
23 real, dimension(2) :: test
24 integer :: n
25 test = n
26 return
27 end function test
28
29 program arr ! The error was not picked up causing an ICE
30 real, dimension(2) :: res
31 res = test(2) ! { dg-error "Explicit interface required" }
32 print *, res
33 end program