static const IntrinsicInterface intrinsicSubroutine[]{
{"abort", {}, {}, Rank::elemental, IntrinsicClass::impureSubroutine},
+ {"atomic_and",
+ {{"atom", AtomicInt, Rank::atom, Optionality::required,
+ common::Intent::InOut},
+ {"value", AnyInt, Rank::scalar, Optionality::required,
+ common::Intent::In},
+ {"stat", AnyInt, Rank::scalar, Optionality::optional,
+ common::Intent::Out}},
+ {}, Rank::elemental, IntrinsicClass::atomicSubroutine},
{"atomic_cas",
{{"atom", SameAtom, Rank::atom, Optionality::required,
common::Intent::InOut},
}
} else if (name == "associated") {
return CheckAssociated(call, context);
+ } else if (name == "atomic_and") {
+ return CheckForCoindexedObject(context, call.arguments[2], name, "stat");
} else if (name == "atomic_cas") {
return CheckForCoindexedObject(context, call.arguments[4], name, "stat");
} else if (name == "atomic_define") {
! RUN: %python %S/test_errors.py %s %flang_fc1
-! XFAIL: *
! This test checks for semantic errors in atomic_and subroutine calls based on
! the interface defined in section 16.9.21 of the Fortran 2018 standard.
program test_atomic_and
- use iso_fortran_env, only: atomic_int_kind
+ use iso_fortran_env, only: atomic_int_kind, atomic_logical_kind
implicit none
integer(kind=atomic_int_kind) :: scalar_coarray[*], non_scalar_coarray(10)[*], val, non_coarray
integer(kind=1) :: kind1_coarray[*]
real :: non_integer_coarray[*]
logical :: non_integer
+ logical(atomic_logical_kind) :: atomic_logical[*]
!___ standard-conforming calls ___
call atomic_and(scalar_coarray, val)
!___ non-standard-conforming calls ___
- !ERROR: 'atom=' argument must be a scalar coarray for intrinsic 'atomic_and'
+ !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_and'
call atomic_and(non_scalar_coarray, val)
- !ERROR: 'atom=' argument must be a coarray or a coindexed object for intrinsic 'atomic_and'
+ !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_and'
+ call atomic_and(non_scalar_coarray[1], val)
+
+ !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_and'
call atomic_and(non_coarray, val)
- !ERROR: 'atom=' argument must be a coarray or a coindexed object for intrinsic 'atomic_and'
+ !ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_and'
call atomic_and(array, val)
!ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(4)'
!ERROR: Actual argument for 'atom=' has bad type 'REAL(4)'
call atomic_and(non_integer_coarray, val)
+ !ERROR: Actual argument for 'atom=' has bad type 'LOGICAL(8)'
+ call atomic_and(atomic_logical, val)
+
!ERROR: 'value=' argument has unacceptable rank 1
call atomic_and(scalar_coarray, array)
!ERROR: 'stat=' argument has unacceptable rank 1
call atomic_and(scalar_coarray, val, status_array)
+ !ERROR: 'stat' argument to 'atomic_and' may not be a coindexed object
call atomic_and(scalar_coarray, val, coindexed_status[1])
!ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' must be definable