brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 10166a0 Raw
59 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2module m13 contains4  real function rf2(x)5    rf2 = x6  end7end8module m29  use m110  real, target :: x = 1.11 contains12  function rpf(x)13    real, intent(in out), target :: x14    real, pointer :: rpf15    rpf => x16  end17  real function rf(x)18    rf = x19  end20  subroutine test121    ! 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 *, x25  end26  subroutine test227    !PORTABILITY: Name 'rf' from host scope should have a type declaration before its local statement function definition [-Wstatement-function-extensions]28    rf(x) = 1.29  end30  subroutine test2b31    !PORTABILITY: Name 'rf2' from host scope should have a type declaration before its local statement function definition [-Wstatement-function-extensions]32    rf2(x) = 1.33  end34  subroutine test335    external sf36    !ERROR: 'sf' has not been declared as an array or pointer-valued function37    sf(x) = 4.38  end39  function f()40    !ERROR: Recursive call to 'f' requires a distinct RESULT in its declaration41    !ERROR: Left-hand side of assignment is not definable42    !BECAUSE: 'f()' is not a variable or pointer43    f() = 1. ! statement function of same name as function44  end45  function g() result(r)46    !WARNING: Name 'g' from host scope should have a type declaration before its local statement function definition [-Wstatement-function-extensions]47    !ERROR: 'g' is already declared in this scoping unit48    g() = 1. ! statement function of same name as function49  end50  function h1() result(r)51    !ERROR: 'r' is not a callable procedure52    r() = 1. ! statement function of same name as function result53  end54  function h2() result(r)55    procedure(real), pointer :: r56    r() = 1. ! not a statement function57  end58end59