[flang] Treat pre-processed input as fixed (#117563)
[llvm-project.git] / flang / test / Semantics / call23.f90
blobe5c205dba885e5ff097da57a1ec559f968e1fb7b
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check errors on MAX/MIN with keywords, a weird case in Fortran
3 real :: x = 0.0, y = 0.0 , y1 = 0.0 ! prevent folding
4 !ERROR: argument keyword 'a1=' was repeated in call to 'max'
5 print *, max(a1=x,a1=1)
6 !ERROR: keyword argument 'a1=' to intrinsic 'max' was supplied positionally by an earlier actual argument
7 print *, max(x,a1=1)
8 !ERROR: keyword argument 'a1=' to intrinsic 'min1' was supplied positionally by an earlier actual argument
9 print *, min1(1.,a1=2.,a2=3.)
10 print *, max(a1=x,a2=0,a4=0) ! ok
11 print *, max(x,0,a99=0) ! ok
12 !ERROR: argument keyword 'a06=' is not known in call to 'max'
13 print *, max(a1=x,a2=0,a06=0)
14 !ERROR: missing mandatory 'a2=' argument
15 print *, max(a3=y, a1=x)
16 !ERROR: missing mandatory 'a1=' argument
17 print *, max(a3=y, a2=x)
18 !ERROR: missing mandatory 'a1=' and 'a2=' arguments
19 print *, max(a3=y, a4=x)
20 !ERROR: missing mandatory 'a2=' argument
21 print *, max(y1, a3=y)
22 !ERROR: missing mandatory 'a1=' and 'a2=' arguments
23 print *, max(a9=x, a5=y, a4=y1)
24 !ERROR: missing mandatory 'a2=' argument
25 print *, max(x)
26 !ERROR: missing mandatory 'a2=' argument
27 print *, max(a1=x)
28 !ERROR: missing mandatory 'a1=' argument
29 print *, max(a2=y)
30 !ERROR: missing mandatory 'a1=' and 'a2=' arguments
31 print *, max(a3=x)
32 !ERROR: argument keyword 'a0=' is not known in call to 'max'
33 print *, max(a0=x)
34 !ERROR: argument keyword 'a03=' is not known in call to 'max'
35 print *, max(a03=x)
36 !ERROR: argument keyword 'abad=' is not known in call to 'max'
37 print *, max(abad=x)
38 !ERROR: actual argument #2 without a keyword may not follow an actual argument with a keyword
39 print *, max(a1=x, y)
40 !ERROR: Keyword argument 'a3=' has already been specified positionally (#3) in this procedure reference
41 print *, max(x, y, y1, a3=x)
42 print *, max(a3=x, a4=x, a2=x, a1=x) ! ok
43 print *, max(a3=x, a2=y, a4=x, a1=x) ! ok
44 print *, max(x, a2=y, a5=x, a4=x) ! ok
45 print *, max(x, y, a4=x, a6=x) ! ok
46 end