|
| 1 | +! RUN: %python %S/test_errors.py %s %flang_fc1 |
| 2 | +! XFAIL: * |
| 3 | +! This test checks for semantic errors in atomic_fetch_xor subroutine calls based on |
| 4 | +! the interface defined in section 16.9.27 of the Fortran 2018 standard. |
| 5 | + |
| 6 | +program test_atomic_fetch_xor |
| 7 | + use iso_fortran_env, only: atomic_int_kind |
| 8 | + implicit none |
| 9 | + |
| 10 | + integer(kind=atomic_int_kind) :: scalar_coarray[*], non_scalar_coarray(10)[*], val, old_val, non_coarray |
| 11 | + integer(kind=atomic_int_kind) :: repeated_atom[*], repeated_old, repeated_val, array(10) |
| 12 | + integer :: status, default_kind_coarray[*], not_same_kind_as_atom, coindexed_status[*], extra_arg, repeated_status, status_array(10) |
| 13 | + integer(kind=1) :: kind1_coarray[*] |
| 14 | + real :: non_integer_coarray[*], not_same_type_as_atom |
| 15 | + logical :: non_integer |
| 16 | + |
| 17 | + !___ standard-conforming calls ___ |
| 18 | + call atomic_fetch_xor(scalar_coarray, val, old_val) |
| 19 | + call atomic_fetch_xor(scalar_coarray[1], val, old_val) |
| 20 | + call atomic_fetch_xor(scalar_coarray, val, old_val, status) |
| 21 | + call atomic_fetch_xor(scalar_coarray[1], val, old_val, status) |
| 22 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, old=old_val, stat=status) |
| 23 | + call atomic_fetch_xor(stat=status, old=old_val, value=val, atom=scalar_coarray) |
| 24 | + |
| 25 | + !___ non-standard-conforming calls ___ |
| 26 | + |
| 27 | + !ERROR: 'atom=' argument must be a scalar coarray for intrinsic 'atomic_fetch_xor' |
| 28 | + call atomic_fetch_xor(non_scalar_coarray, val, old_val) |
| 29 | + |
| 30 | + !ERROR: 'atom=' argument must be a coarray or a coindexed object for intrinsic 'atomic_fetch_xor' |
| 31 | + call atomic_fetch_xor(non_coarray, val, old_val) |
| 32 | + |
| 33 | + !ERROR: 'atom=' argument must be a coarray or a coindexed object for intrinsic 'atomic_fetch_xor' |
| 34 | + call atomic_fetch_xor(array, val, old_val) |
| 35 | + |
| 36 | + !ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(4)' |
| 37 | + call atomic_fetch_xor(default_kind_coarray, val, old_val) |
| 38 | + |
| 39 | + !ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(1)' |
| 40 | + call atomic_fetch_xor(kind1_coarray, val, old_val) |
| 41 | + |
| 42 | + !ERROR: Actual argument for 'atom=' has bad type 'REAL(4)' |
| 43 | + call atomic_fetch_xor(non_integer_coarray, val, old_val) |
| 44 | + |
| 45 | + !ERROR: 'value=' argument has unacceptable rank 1 |
| 46 | + call atomic_fetch_xor(scalar_coarray, array, old_val) |
| 47 | + |
| 48 | + !ERROR: Actual argument for 'value=' has bad type 'LOGICAL(4)' |
| 49 | + call atomic_fetch_xor(scalar_coarray, non_integer, old_val) |
| 50 | + |
| 51 | + !ERROR: Actual argument for 'old=' must have kind=atomic_int_kind, but is 'INTEGER(4)' |
| 52 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, old=not_same_kind_as_atom) |
| 53 | + |
| 54 | + !ERROR: Actual argument for 'old=' has bad type 'REAL(4)' |
| 55 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, old=not_same_type_as_atom) |
| 56 | + |
| 57 | + !ERROR: Actual argument for 'old=' must have kind=atomic_int_kind, but is 'INTEGER(4)' |
| 58 | + call atomic_fetch_xor(scalar_coarray, val, 1) |
| 59 | + |
| 60 | + !ERROR: 'old=' argument has unacceptable rank 1 |
| 61 | + call atomic_fetch_xor(scalar_coarray, val, array) |
| 62 | + |
| 63 | + !ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)' |
| 64 | + call atomic_fetch_xor(scalar_coarray, val, old_val, non_integer) |
| 65 | + |
| 66 | + !ERROR: 'stat=' argument has unacceptable rank 1 |
| 67 | + call atomic_fetch_xor(scalar_coarray, val, old_val, status_array) |
| 68 | + |
| 69 | + call atomic_fetch_xor(scalar_coarray, val, old_val, coindexed_status[1]) |
| 70 | + |
| 71 | + !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' must be definable |
| 72 | + call atomic_fetch_xor(scalar_coarray, val, old_val, 1) |
| 73 | + |
| 74 | + !ERROR: missing mandatory 'atom=' argument |
| 75 | + call atomic_fetch_xor() |
| 76 | + |
| 77 | + !ERROR: missing mandatory 'atom=' argument |
| 78 | + call atomic_fetch_xor(value=val, old=old_val, stat=status) |
| 79 | + |
| 80 | + !ERROR: missing mandatory 'value=' argument |
| 81 | + call atomic_fetch_xor(scalar_coarray) |
| 82 | + |
| 83 | + !ERROR: missing mandatory 'value=' argument |
| 84 | + call atomic_fetch_xor(atom=scalar_coarray, old=old_val, stat=status) |
| 85 | + |
| 86 | + !ERROR: missing mandatory 'old=' argument |
| 87 | + call atomic_fetch_xor(scalar_coarray, val) |
| 88 | + |
| 89 | + !ERROR: missing mandatory 'old=' argument |
| 90 | + call atomic_fetch_xor(atom=scalar_coarray, value=val) |
| 91 | + |
| 92 | + !ERROR: too many actual arguments for intrinsic 'atomic_fetch_xor' |
| 93 | + call atomic_fetch_xor(scalar_coarray, val, old_val, status, extra_arg) |
| 94 | + |
| 95 | + !ERROR: repeated keyword argument to intrinsic 'atomic_fetch_xor' |
| 96 | + call atomic_fetch_xor(atom=scalar_coarray, atom=repeated_atom, value=val, old=old_val, stat=status) |
| 97 | + |
| 98 | + !ERROR: repeated keyword argument to intrinsic 'atomic_fetch_xor' |
| 99 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, value=repeated_val, old=old_val, stat=status) |
| 100 | + |
| 101 | + !ERROR: repeated keyword argument to intrinsic 'atomic_fetch_xor' |
| 102 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, old=old_val, old=repeated_old, stat=status) |
| 103 | + |
| 104 | + !ERROR: repeated keyword argument to intrinsic 'atomic_fetch_xor' |
| 105 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, old=old_val, stat=status, stat=repeated_status) |
| 106 | + |
| 107 | + !ERROR: unknown keyword argument to intrinsic 'atomic_fetch_xor' |
| 108 | + call atomic_fetch_xor(atomic=scalar_coarray, value=val, old=old_val, stat=status) |
| 109 | + |
| 110 | + !ERROR: unknown keyword argument to intrinsic 'atomic_fetch_xor' |
| 111 | + call atomic_fetch_xor(atom=scalar_coarray, values=val, old=old_val, stat=status) |
| 112 | + |
| 113 | + !ERROR: unknown keyword argument to intrinsic 'atomic_fetch_xor' |
| 114 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, oldvalue=old_val, stat=status) |
| 115 | + |
| 116 | + !ERROR: unknown keyword argument to intrinsic 'atomic_fetch_xor' |
| 117 | + call atomic_fetch_xor(atom=scalar_coarray, value=val, old=old_val, status=status) |
| 118 | + |
| 119 | + !ERROR: keyword argument to intrinsic 'atomic_fetch_xor' was supplied positionally by an earlier actual argument |
| 120 | + call atomic_fetch_xor(scalar_coarray, val, old_val, atom=repeated_atom) |
| 121 | + |
| 122 | + !ERROR: keyword argument to intrinsic 'atomic_fetch_xor' was supplied positionally by an earlier actual argument |
| 123 | + call atomic_fetch_xor(scalar_coarray, val, old_val, value=repeated_val) |
| 124 | + |
| 125 | + !ERROR: keyword argument to intrinsic 'atomic_fetch_xor' was supplied positionally by an earlier actual argument |
| 126 | + call atomic_fetch_xor(scalar_coarray, val, old_val, status, stat=repeated_status) |
| 127 | + |
| 128 | +end program test_atomic_fetch_xor |
0 commit comments