brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.1 KiB · 453fdb1 Raw
153 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in atomic_define subroutine calls based on3! the interface defined in section 16.9.23 of the Fortran 2018 standard.4 5program test_atomic_define6  use iso_fortran_env, only: atomic_int_kind, atomic_logical_kind7  implicit none(external, type)8 9  integer(kind=atomic_int_kind) :: scalar_coarray[*], non_scalar_coarray(10)[*], val, non_coarray10  integer(kind=atomic_int_kind) :: repeated_atom[*], repeated_val, array(10)11  integer :: status, default_kind_coarray[*], coindexed_status[*], extra_arg, repeated_status, status_array(10), default_int_val12  real :: non_integer_coarray[*], non_int_or_logical13  logical(kind=atomic_logical_kind) :: atom_logical[*], val_logical, non_scalar_logical_coarray(10)[*], non_coarray_logical14  logical :: non_integer, default_kind_logical_coarray[*], default_logical_val15 16  ! These variables are used in this test based on the assumption that atomic_int_kind is not equal to kind=117  ! This is true at the time of writing of the test, but of course is not guaranteed to stay the same18  integer(kind=1) :: kind1_coarray[*]19  logical(kind=1) :: kind1_logical_coarray[*]20 21  !___ standard-conforming calls ___22  call atomic_define(scalar_coarray, val)23  call atomic_define(scalar_coarray, default_int_val)24  call atomic_define(scalar_coarray[1], val)25  call atomic_define(scalar_coarray, default_int_val, status)26  call atomic_define(scalar_coarray[1], val, status)27  call atomic_define(scalar_coarray, default_int_val, stat=status)28  call atomic_define(scalar_coarray, value=val, stat=status)29  call atomic_define(atom=scalar_coarray, value=default_int_val)30  call atomic_define(atom=scalar_coarray, value=val, stat=status)31  call atomic_define(stat=status, value=default_int_val, atom=scalar_coarray)32 33  call atomic_define(atom_logical, val_logical)34  call atomic_define(atom_logical, default_logical_val)35  call atomic_define(atom_logical[1], val_logical)36  call atomic_define(atom_logical, val_logical, status)37  call atomic_define(atom_logical[1], val_logical, status)38  call atomic_define(atom_logical, val_logical, stat=status)39  call atomic_define(atom_logical, value=val_logical, stat=status)40  call atomic_define(atom=atom_logical, value=val_logical)41  call atomic_define(atom=atom_logical, value=val_logical, stat=status)42  call atomic_define(stat=status, value=val_logical, atom=atom_logical)43 44  !___ non-standard-conforming calls ___45 46  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'47  call atomic_define(non_scalar_coarray, val)48 49  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'50  call atomic_define(non_scalar_coarray(:)[1], val)51 52  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'53  call atomic_define(non_scalar_logical_coarray, val_logical)54 55  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'56  call atomic_define(non_scalar_logical_coarray(:)[1], val_logical)57 58  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'59  call atomic_define(non_coarray, val)60 61  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'62  call atomic_define(non_coarray_logical, val_logical)63 64  !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_define'65  call atomic_define(array, val)66 67  !ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(4)'68  call atomic_define(default_kind_coarray, val)69 70  !ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(1)'71  call atomic_define(kind1_coarray, val)72 73  !ERROR: Actual argument for 'atom=' must have kind=atomic_logical_kind, but is 'LOGICAL(4)'74  call atomic_define(default_kind_logical_coarray, val_logical)75 76  !ERROR: Actual argument for 'atom=' must have kind=atomic_logical_kind, but is 'LOGICAL(1)'77  call atomic_define(kind1_logical_coarray, val_logical)78 79  !ERROR: 'value=' argument to 'atomic_define' must have same type as 'atom=', but is 'LOGICAL(8)'80  call atomic_define(scalar_coarray, val_logical)81 82  !ERROR: 'value=' argument to 'atomic_define' must have same type as 'atom=', but is 'INTEGER(8)'83  call atomic_define(atom_logical, val)84 85  !ERROR: Actual argument for 'atom=' has bad type 'REAL(4)'86  call atomic_define(non_integer_coarray, val)87 88  !ERROR: 'value=' argument has unacceptable rank 189  call atomic_define(scalar_coarray, array)90 91  !ERROR: Actual argument for 'value=' has bad type 'REAL(4)'92  call atomic_define(scalar_coarray, non_int_or_logical)93 94  !ERROR: Actual argument for 'value=' has bad type 'REAL(4)'95  call atomic_define(atom_logical, non_int_or_logical)96 97  !ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'98  call atomic_define(scalar_coarray, val, non_integer)99 100  !ERROR: 'stat=' argument has unacceptable rank 1101  call atomic_define(scalar_coarray, val, status_array)102 103  !ERROR: 'stat' argument to 'atomic_define' may not be a coindexed object104  call atomic_define(scalar_coarray, val, coindexed_status[1])105 106  !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' is not definable107  !BECAUSE: '1_4' is not a variable or pointer108  call atomic_define(scalar_coarray, val, 1)109 110  !ERROR: missing mandatory 'atom=' argument111  call atomic_define()112 113  !ERROR: missing mandatory 'atom=' argument114  call atomic_define(value=val, stat=status)115 116  !ERROR: missing mandatory 'value=' argument117  call atomic_define(scalar_coarray)118 119  !ERROR: missing mandatory 'value=' argument120  call atomic_define(atom=scalar_coarray, stat=status)121 122  !ERROR: too many actual arguments for intrinsic 'atomic_define'123  call atomic_define(scalar_coarray, val, status, extra_arg)124 125  !ERROR: repeated keyword argument to intrinsic 'atomic_define'126  call atomic_define(atom=scalar_coarray, atom=repeated_atom, value=val, stat=status)127 128  !ERROR: repeated keyword argument to intrinsic 'atomic_define'129  call atomic_define(atom=scalar_coarray, value=val, value=repeated_val, stat=status)130 131  !ERROR: repeated keyword argument to intrinsic 'atomic_define'132  call atomic_define(atom=scalar_coarray, value=val, stat=status, stat=repeated_status)133 134  !ERROR: unknown keyword argument to intrinsic 'atomic_define'135  call atomic_define(atomic=scalar_coarray, value=val, stat=status)136 137  !ERROR: unknown keyword argument to intrinsic 'atomic_define'138  call atomic_define(atom=scalar_coarray, values=val, stat=status)139 140  !ERROR: unknown keyword argument to intrinsic 'atomic_define'141  call atomic_define(atom=scalar_coarray, value=val, status=status)142 143  !ERROR: keyword argument to intrinsic 'atomic_define' was supplied positionally by an earlier actual argument144  call atomic_define(scalar_coarray, val, atom=repeated_atom)145 146  !ERROR: keyword argument to intrinsic 'atomic_define' was supplied positionally by an earlier actual argument147  call atomic_define(scalar_coarray, val, value=repeated_val)148 149  !ERROR: keyword argument to intrinsic 'atomic_define' was supplied positionally by an earlier actual argument150  call atomic_define(scalar_coarray, val, status, stat=repeated_status)151 152end program test_atomic_define153