File: event_query.f90

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (118 lines) | stat: -rw-r--r-- 4,554 bytes parent folder | download | duplicates (4)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
! RUN: %python %S/test_errors.py %s %flang_fc1
! This test checks for semantic errors in event_query() subroutine based on the
! statement specification in section 16.9.72 of the Fortran 2018 standard.

program test_event_query
  use iso_fortran_env, only : event_type
  implicit none(type,external)

  type(event_type) concert[*], occurrences(2)[*]
  integer non_event[*], counter, array(1), coarray[*], sync_status, coindexed[*], non_scalar(1)
  integer(kind=1) non_default
  logical non_integer

  !___ standard-conforming calls with required arguments _______

  call event_query(concert, counter)
  call event_query(occurrences(1), counter)
  call event_query(concert, array(1))
  call event_query(concert, coarray[1])
  call event_query(event=concert, count=counter)
  call event_query(count=counter, event=concert)

  !___ standard-conforming calls with all arguments ____________
  call event_query(concert, counter, sync_status)
  call event_query(concert, counter, array(1))
  call event_query(event=concert, count=counter, stat=sync_status)
  call event_query(stat=sync_status, count=counter, event=concert)

  !___ non-standard-conforming calls _______

  ! event-variable must be event_type
  ! ERROR: Actual argument for 'event=' has bad type 'INTEGER(4)'
  call event_query(non_event, counter)

  ! event-variable must be a scalar variable
  ! ERROR: 'event=' argument has unacceptable rank 1
  call event_query(occurrences, counter)

  ! event-variable must not be coindexed
  ! ERROR: EVENT= argument to EVENT_QUERY must not be coindexed
  call event_query(concert[1], counter)

  ! event-variable has an unknown keyword argument
  ! ERROR: unknown keyword argument to intrinsic 'event_query'
  call event_query(events=concert, count=counter)

  ! event-variable has an argument mismatch
  ! ERROR: Actual argument for 'event=' has bad type 'INTEGER(4)'
  call event_query(event=non_event, count=counter)

  ! count must be an integer
  ! ERROR: Actual argument for 'count=' has bad type 'LOGICAL(4)'
  call event_query(concert, non_integer)

  ! count must be an integer scalar
  ! ERROR: 'count=' argument has unacceptable rank 1
  call event_query(concert, non_scalar)

  ! count must be have a decimal exponent range
  ! no smaller than that of default integer
  ! ERROR: COUNT= argument to EVENT_QUERY must be an integer with kind >= 4
  call event_query(concert, non_default)

  ! count is an intent(out) argument
  ! ERROR: Actual argument associated with INTENT(OUT) dummy argument 'count=' is not definable
  ! ERROR: '4_4' is not a variable or pointer
  call event_query(concert, 4)

  ! count has an unknown keyword argument
  ! ERROR: unknown keyword argument to intrinsic 'event_query'
  call event_query(concert, counts=counter)

  ! count has an argument mismatch
  ! ERROR: Actual argument for 'count=' has bad type 'LOGICAL(4)'
  call event_query(concert, count=non_integer)

  ! stat must be an integer
  ! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'
  call event_query(concert, counter, non_integer)

  ! stat must be an integer scalar
  ! ERROR: 'stat=' argument has unacceptable rank 1
  call event_query(concert, counter, 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 event_query(concert, counter, 8)

  ! stat has an unknown keyword argument
  ! ERROR: unknown keyword argument to intrinsic 'event_query'
  call event_query(concert, counter, status=sync_status)

  ! stat has an argument mismatch
  ! ERROR: Actual argument for 'stat=' has bad type 'LOGICAL(4)'
  call event_query(concert, counter, stat=non_integer)

  ! stat must not be coindexed
  ! ERROR: 'stat' argument to 'event_query' may not be a coindexed object
  call event_query(concert, counter, coindexed[1])

  ! Too many arguments
  ! ERROR: too many actual arguments for intrinsic 'event_query'
  call event_query(concert, counter, sync_status, array(1))

  ! Repeated event keyword
  ! ERROR: repeated keyword argument to intrinsic 'event_query'
  call event_query(event=concert, event=occurrences(1), count=counter)

  ! Repeated count keyword
  ! ERROR: repeated keyword argument to intrinsic 'event_query'
  call event_query(event=concert, count=counter, count=array(1))

  ! Repeated stat keyword
  ! ERROR: repeated keyword argument to intrinsic 'event_query'
  call event_query(event=concert, count=counter, stat=sync_status, stat=array(1))

end program test_event_query