Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

110 lines
4.3 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! This test checks for semantic errors in atomic_add() subroutine based on the
! statement specification in section 16.9.20 of the Fortran 2018 standard.
program test_atomic_add
use iso_fortran_env, only : atomic_int_kind
implicit none(external, type)
integer(kind=atomic_int_kind) atom_object[*], atom_array(2)[*], quantity, array(1), coarray[*], non_coarray
integer non_atom_object[*], non_scalar(1), status, stat_array(1), coindexed[*]
logical non_integer
!___ standard-conforming calls with required arguments _______
call atomic_add(atom_object, quantity)
call atomic_add(atom_object[1], quantity)
call atomic_add(atom_array(1), quantity)
call atomic_add(atom_array(1)[1], quantity)
call atomic_add(atom_object, array(1))
call atomic_add(atom_object, coarray[1])
call atomic_add(atom=atom_object, value=quantity)
call atomic_add(value=quantity, atom=atom_object)
!___ standard-conforming calls with all arguments ____________
call atomic_add(atom_object, quantity, status)
call atomic_add(atom_object, quantity, stat_array(1))
call atomic_add(atom=atom_object, value=quantity, stat=status)
call atomic_add(stat=status, value=quantity, atom=atom_object)
!___ non-standard-conforming calls _______
! atom must be of kind atomic_int_kind
! ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(4)'
call atomic_add(non_atom_object, quantity)
! atom must be a coarray
! ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_add'
call atomic_add(non_coarray, quantity)
! atom must be a scalar variable
! ERROR: 'atom=' argument must be a scalar coarray or coindexed object for intrinsic 'atomic_add'
call atomic_add(atom_array, quantity)
! atom has an unknown keyword argument
! ERROR: unknown keyword argument to intrinsic 'atomic_add'
call atomic_add(atoms=atom_object, value=quantity)
! atom has an argument mismatch
! ERROR: Actual argument for 'atom=' must have kind=atomic_int_kind, but is 'INTEGER(4)'
call atomic_add(atom=non_atom_object, value=quantity)
! value must be an integer
! ERROR: Actual argument for 'value=' has bad type 'LOGICAL(4)'
call atomic_add(atom_object, non_integer)
! value must be an integer scalar
! ERROR: 'value=' argument has unacceptable rank 1
call atomic_add(atom_object, array)
! value has an unknown keyword argument
! ERROR: unknown keyword argument to intrinsic 'atomic_add'
call atomic_add(atom_object, values=quantity)
! value has an argument mismatch
! ERROR: Actual argument for 'value=' has bad type 'LOGICAL(4)'
call atomic_add(atom_object, value=non_integer)
! stat must be an integer
! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'
call atomic_add(atom_object, quantity, non_integer)
! stat must be an integer scalar
! ERROR: 'stat=' argument has unacceptable rank 1
call atomic_add(atom_object, quantity, non_scalar)
! stat is an intent(out) argument
! ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' is not definable
! ERROR: '8_4' is not a variable or pointer
call atomic_add(atom_object, quantity, 8)
! stat has an unknown keyword argument
! ERROR: unknown keyword argument to intrinsic 'atomic_add'
call atomic_add(atom_object, quantity, statuses=status)
! stat has an argument mismatch
! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'
call atomic_add(atom_object, quantity, stat=non_integer)
! stat must not be coindexed
! ERROR: 'stat' argument to 'atomic_add' may not be a coindexed object
call atomic_add(atom_object, quantity, coindexed[1])
! Too many arguments
! ERROR: too many actual arguments for intrinsic 'atomic_add'
call atomic_add(atom_object, quantity, status, stat_array(1))
! Repeated atom keyword
! ERROR: repeated keyword argument to intrinsic 'atomic_add'
call atomic_add(atom=atom_object, atom=atom_array(1), value=quantity)
! Repeated value keyword
! ERROR: repeated keyword argument to intrinsic 'atomic_add'
call atomic_add(atom=atom_object, value=quantity, value=array(1))
! Repeated stat keyword
! ERROR: repeated keyword argument to intrinsic 'atomic_add'
call atomic_add(atom=atom_object, value=quantity, stat=status, stat=stat_array(1))
end program test_atomic_add