2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: ATOMIC_ADD, Atomic subroutine, add
10 ATOMIC_ADD --- Atomic ADD operation
11 ***********************************
13 .. function:: ATOMIC_ADD(ATOM, VALUE)
15 ``ATOMIC_ADD(ATOM, VALUE)`` atomically adds the value of :samp:`{VALUE}` to the
16 variable :samp:`{ATOM}`. When :samp:`{STAT}` is present and the invocation was
17 successful, it is assigned the value 0. If it is present and the invocation
18 has failed, it is assigned a positive value; in particular, for a coindexed
19 :samp:`{ATOM}`, if the remote image has stopped, it is assigned the value of
20 ``ISO_FORTRAN_ENV`` 's ``STAT_STOPPED_IMAGE`` and if the remote image has
21 failed, the value ``STAT_FAILED_IMAGE``.
24 Scalar coarray or coindexed variable of integer
25 type with ``ATOMIC_INT_KIND`` kind.
28 Scalar of the same type as :samp:`{ATOM}`. If the kind
29 is different, the value is converted to the kind of :samp:`{ATOM}`.
32 (optional) Scalar default-kind integer variable.
41 .. code-block:: fortran
43 CALL ATOMIC_ADD (ATOM, VALUE [, STAT])
46 .. code-block:: fortran
50 integer(atomic_int_kind) :: atom[*]
51 call atomic_add (atom[1], this_image())
56 :ref:`ATOMIC_FETCH_ADD`,
57 :ref:`ISO_FORTRAN_ENV`,