1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic 2module m1 3 contains 4 real function rf2(x) 5 rf2 = x 6 end 7end 8module m2 9 use m1 10 real, target :: x = 1. 11 contains 12 function rpf(x) 13 real, intent(in out), target :: x 14 real, pointer :: rpf 15 rpf => x 16 end 17 real function rf(x) 18 rf = x 19 end 20 subroutine test1 21 ! This is a valid assignment, not a statement function. 22 ! Every other Fortran compiler misinterprets it! 23 rpf(x) = 2. ! statement function or indirect assignment? 24 print *, x 25 end 26 subroutine test2 27 !PORTABILITY: Name 'rf' from host scope should have a type declaration before its local statement function definition 28 rf(x) = 1. 29 end 30 subroutine test2b 31 !PORTABILITY: Name 'rf2' from host scope should have a type declaration before its local statement function definition 32 rf2(x) = 1. 33 end 34 subroutine test3 35 external sf 36 !ERROR: 'sf' has not been declared as an array or pointer-valued function 37 sf(x) = 4. 38 end 39 function f() 40 !ERROR: Recursive call to 'f' requires a distinct RESULT in its declaration 41 !ERROR: Left-hand side of assignment is not definable 42 !BECAUSE: 'f()' is not a variable or pointer 43 f() = 1. ! statement function of same name as function 44 end 45 function g() result(r) 46 !WARNING: Name 'g' from host scope should have a type declaration before its local statement function definition 47 !ERROR: 'g' is already declared in this scoping unit 48 g() = 1. ! statement function of same name as function 49 end 50 function h1() result(r) 51 !ERROR: 'r' is not a callable procedure 52 r() = 1. ! statement function of same name as function result 53 end 54 function h2() result(r) 55 procedure(real), pointer :: r 56 r() = 1. ! not a statement function 57 end 58end 59