2 ! Tests the patch for PR27613, in which directly recursive, scalar
3 ! functions were generating an "unclassifiable statement" error
4 ! for the recursive statement(s).
6 ! Based on PR testcase by Nicolas Bock <nicolasbock@gmail.com>
9 if (original_stuff(1) .ne
. 5) call abort ()
10 if (scalar_stuff(-4) .ne
. 10) call abort ()
11 if (any (array_stuff((/-19,-30/)) .ne
. (/25,25/))) call abort ()
13 recursive function original_stuff(n
)
14 integer :: original_stuff
18 original_stuff
= original_stuff
+ original_stuff (n
+1)
20 end function original_stuff
22 recursive function scalar_stuff(n
) result (tmp
)
27 tmp
= tmp
+ scalar_stuff (n
+1)
29 end function scalar_stuff
31 recursive function array_stuff(n
) result (tmp
)
35 if(maxval (n
) < 5) then
36 tmp
= tmp
+ array_stuff (n
+1)
38 end function array_stuff
40 recursive function bad_stuff(n
)
41 integer :: bad_stuff (2)
44 if(maxval (n
) < 5) then
45 bad_stuff
= bad_stuff
+ bad_stuff (n
+1) ! { dg-error "RESULT must be specified" }
47 end function bad_stuff