[Flang][RISCV] Set vscale_range based off zvl*b (#77277)
[llvm-project.git] / flang / test / Semantics / stmt-func02.f90
blob0f4e8c034f659a1a958622e14eb445b22591e67e
1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2 module m
3 real, target :: x = 1.
4 contains
5 function rpf(x)
6 real, intent(in out), target :: x
7 real, pointer :: rpf
8 rpf => x
9 end
10 real function rf(x)
11 rf = x
12 end
13 subroutine test1
14 ! This is a valid assignment, not a statement function.
15 ! Every other Fortran compiler misinterprets it!
16 rpf(x) = 2. ! statement function or indirect assignment?
17 print *, x
18 end
19 subroutine test2
20 !PORTABILITY: Name 'rf' from host scope should have a type declaration before its local statement function definition
21 rf(x) = 3.
22 end
23 subroutine test3
24 external sf
25 !ERROR: 'sf' has not been declared as an array or pointer-valued function
26 sf(x) = 4.
27 end
28 function f()
29 !ERROR: Recursive call to 'f' requires a distinct RESULT in its declaration
30 !ERROR: Left-hand side of assignment is not definable
31 !BECAUSE: 'f()' is not a variable or pointer
32 f() = 1. ! statement function of same name as function
33 end
34 function g() result(r)
35 !WARNING: Name 'g' from host scope should have a type declaration before its local statement function definition
36 !ERROR: 'g' is already declared in this scoping unit
37 g() = 1. ! statement function of same name as function
38 end
39 function h1() result(r)
40 !ERROR: 'r' is not a callable procedure
41 r() = 1. ! statement function of same name as function result
42 end
43 function h2() result(r)
44 procedure(real), pointer :: r
45 r() = 1. ! not a statement function
46 end
47 end