[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / collectives02.f90
blob3fdf902a1912d3e540066d41177d82366b115a26
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! XFAIL: *
3 ! This test checks for semantic errors in co_min subroutine calls based on
4 ! the co_min interface defined in section 16.9.48 of the Fortran 2018 standard.
5 ! To Do: add co_min to the list of intrinsics
7 program test_co_min
8 implicit none
10 integer i, integer_array(1), coindexed_integer[*], status
11 character(len=1) c, character_array(1), coindexed_character[*], message
12 double precision d, double_precision_array(1)
13 real r, real_array(1), coindexed_real[*]
14 complex complex_type
15 logical bool
17 !___ standard-conforming calls with no keyword arguments ___
18 call co_min(i)
19 call co_min(c)
20 call co_min(d)
21 call co_min(r)
22 call co_min(i, 1)
23 call co_min(c, 1, status)
24 call co_min(d, 1, status, message)
25 call co_min(r, 1, status, message)
26 call co_min(integer_array)
27 call co_min(character_array, 1)
28 call co_min(double_precision_array, 1, status)
29 call co_min(real_array, 1, status, message)
31 !___ standard-conforming calls with keyword arguments ___
33 ! all arguments present
34 call co_min(a=i, result_image=1, stat=status, errmsg=message)
35 call co_min(result_image=1, a=i, errmsg=message, stat=status)
37 ! one optional argument not present
38 call co_min(a=i, stat=status, errmsg=message)
39 call co_min(a=i, result_image=1, errmsg=message)
40 call co_min(a=i, result_image=1, stat=status )
42 ! two optional arguments not present
43 call co_min(a=i, result_image=1 )
44 call co_min(a=i, stat=status )
45 call co_min(a=i, errmsg=message)
47 ! no optional arguments present
48 call co_min(a=i)
50 !___ non-standard-conforming calls ___
52 ! argument 'a' shall be of numeric type
53 !ERROR: Actual argument for 'a=' has bad type 'LOGICAL(4)'
54 call co_min(bool)
56 ! argument 'a' shall be of numeric type
57 !ERROR: Actual argument for 'a=' has bad type 'COMPLEX(4)'
58 call co_min(complex_type)
60 ! argument 'a' is intent(inout)
61 !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'a=' must be definable
62 call co_min(a=1+1)
64 ! argument 'a' shall not be a coindexed object
65 !ERROR: to be determined
66 call co_min(a=coindexed_real[1])
68 ! 'result_image' argument shall be a scalar
69 !ERROR: too many actual arguments for intrinsic 'co_min'
70 call co_min(i, result_image=bool)
72 ! 'result_image' argument shall be an integer scalar
73 !ERROR: too many actual arguments for intrinsic 'co_min'
74 call co_min(c, result_image=integer_array)
76 ! 'stat' argument shall be noncoindexed
77 !ERROR: to be determined
78 call co_min(d, stat=coindexed_integer[1])
80 ! 'stat' argument shall be an integer
81 !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)'
82 call co_min(r, stat=message)
84 ! 'stat' argument shall be an integer scalar
85 !ERROR: 'stat=' argument has unacceptable rank 1
86 call co_min(i, stat=integer_array)
88 ! 'errmsg' argument shall be noncoindexed
89 !ERROR: to be determined
90 call co_min(c, errmsg=coindexed_character[1])
92 ! 'errmsg' argument shall be character scalar
93 !ERROR: 'errmsg=' argument has unacceptable rank 1
94 call co_min(d, errmsg=character_array)
96 ! the error is seen as too many arguments to the co_min() call
97 !ERROR: too many actual arguments for intrinsic 'co_min'
98 call co_min(r, result_image=1, stat=status, errmsg=message, 3.4)
100 ! keyword argument with incorrect name
101 !ERROR: unknown keyword argument to intrinsic 'co_min'
102 call co_min(fake=3.4)
104 end program test_co_min