49 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! 15.4.2.2. Test that errors are reported when an explicit interface3! is not provided for an external procedure that requires an explicit4! interface (the definition needs to be visible so that the compiler5! can detect the violation).6 7subroutine foo(a_pointer)8 real, pointer :: a_pointer(:)9end subroutine10 11subroutine bar(a_pointer)12 procedure(real), pointer :: a_pointer13end subroutine14 15subroutine baz(proc)16 external :: proc17 real, optional :: proc18end subroutine19 20subroutine test()21 real, pointer :: a_pointer(:)22 real, pointer :: an_array(:)23 intrinsic :: sin24 25 ! This call would be allowed if the interface was explicit here,26 ! but its handling with an implicit interface is different (no27 ! descriptor involved, copy-in/copy-out...)28 29 !ERROR: References to the procedure 'foo' require an explicit interface30 !BECAUSE: a dummy argument has the allocatable, asynchronous, optional, pointer, target, value, or volatile attribute31 call foo(a_pointer)32 33 ! This call would be error if the interface was explicit here.34 35 !ERROR: References to the procedure 'foo' require an explicit interface36 !BECAUSE: a dummy argument has the allocatable, asynchronous, optional, pointer, target, value, or volatile attribute37 call foo(an_array)38 39 !ERROR: References to the procedure 'bar' require an explicit interface40 !BECAUSE: a dummy procedure is optional or a pointer41 !WARNING: If the procedure's interface were explicit, this reference would be in error [-Wknown-bad-implicit-interface]42 !BECAUSE: Actual argument associated with procedure pointer dummy argument 'a_pointer=' is not a procedure pointer43 call bar(sin)44 45 !ERROR: References to the procedure 'baz' require an explicit interface46 !BECAUSE: a dummy procedure is optional or a pointer47 call baz(sin)48end subroutine49