4 ! Check that a call to a procedure's containing procedure counts as recursive
5 ! and is rejected if the containing procedure is not RECURSIVE.
12 SUBROUTINE test_sub ()
17 PROCEDURE(test_sub), POINTER :: procptr
19 CALL test_sub () ! { dg-error "not RECURSIVE" }
20 procptr => test_sub ! { dg-warning "Non-RECURSIVE" }
21 CALL foobar (test_sub) ! { dg-warning "Non-RECURSIVE" }
23 END SUBROUTINE test_sub
25 INTEGER FUNCTION test_func () RESULT (x)
28 INTEGER FUNCTION bar ()
30 PROCEDURE(test_func), POINTER :: procptr
32 bar = test_func () ! { dg-error "not RECURSIVE" }
33 procptr => test_func ! { dg-warning "Non-RECURSIVE" }
34 CALL foobar (test_func) ! { dg-warning "Non-RECURSIVE" }
36 END FUNCTION test_func
38 SUBROUTINE sub_entries ()
44 CALL sub_entry_1 () ! { dg-error "is not RECURSIVE" }
46 END SUBROUTINE sub_entries
48 INTEGER FUNCTION func_entries () RESULT (x)
49 ENTRY func_entry_1 () RESULT (x)
50 ENTRY func_entry_2 () RESULT (x)
53 INTEGER FUNCTION bar ()
54 bar = func_entry_1 () ! { dg-error "is not RECURSIVE" }
56 END FUNCTION func_entries
61 PRINT *, test_func (), func_entries ()
66 ! { dg-final { cleanup-modules "m" } }