File: atomic01.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (93 lines) | stat: -rw-r--r-- 3,085 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
! RUN: %python %S/test_errors.py %s %flang_fc1
! XFAIL: *
! 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

  integer(kind=atomic_int_kind) atom_object[*], atom_array(2)[*], quantity, array(1), coarray[*], non_coarray
  integer non_atom_object[*], non_atom, 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
  call atomic_add(non_atom_object, quantity)

  ! atom must be a coarray
  call atomic_add(non_coarray, quantity)

  ! atom must be a scalar variable
  call atomic_add(atom_array, quantity)

  ! atom has an unknown keyword argument
  call atomic_add(atoms=atom_object, value=quantity)

  ! atom has an argument mismatch
  call atomic_add(atom=non_atom_object, value=quantity)

  ! value must be an integer
  call atomic_add(atom_object, non_integer)

  ! value must be an integer scalar
  call atomic_add(atom_object, array)

  ! value must be of kind atomic_int_kind
  call atomic_add(atom_object, non_atom)

  ! value has an unknown keyword argument
  call atomic_add(atom_object, values=quantity)

  ! value has an argument mismatch
  call atomic_add(atom_object, value=non_integer)

  ! stat must be an integer
  call atomic_add(atom_object, quantity, non_integer)

  ! stat must be an integer scalar
  call atomic_add(atom_object, quantity, non_scalar)

  ! stat is an intent(out) argument
  call atomic_add(atom_object, quantity, 8)

  ! stat has an unknown keyword argument
  call atomic_add(atom_object, quantity, statuses=status)

  ! stat has an argument mismatch
  call atomic_add(atom_object, quantity, stat=non_integer)

  ! stat must not be coindexed
  call atomic_add(atom_object, quantity, coindexed[1])

  ! Too many arguments
  call atomic_add(atom_object, quantity, status, stat_array(1))

  ! Repeated atom keyword
  call atomic_add(atom=atom_object, atom=atom_array(1), value=quantity)

  ! Repeated value keyword
  call atomic_add(atom=atom_object, value=quantity, value=array(1))

  ! Repeated stat keyword
  call atomic_add(atom=atom_object, value=quantity, stat=status, stat=stat_array(1))

end program test_atomic_add