File: lockstmt03.f90

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (94 lines) | stat: -rw-r--r-- 3,179 bytes parent folder | download | duplicates (14)
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
! RUN: %python %S/test_errors.py %s %flang_fc1
! XFAIL: *
! This test checks for semantic errors in lock statements based on the
! statement specification in section 11.6.10 of the Fortran 2018 standard.

program test_lock_stmt
  use iso_fortran_env, only: lock_type, event_type
  implicit none

  character(len=128) error_message, msg_array(10), coindexed_msg[*], repeated_msg
  integer status, stat_array(10), coindexed_int[*], non_bool, repeated_stat
  logical non_integer, bool, bool_array(10), non_char, coindexed_logical[*], repeated_bool
  type(lock_type) :: lock_var[*], lock_array(10)[*], non_coarray_lock
  type(event_type) :: not_lock_var[*]

  !___ non-standard-conforming statements ___

! type mismatches

  !ERROR: to be determined
  lock(not_lock_var)

  !ERROR: Must have LOGICAL type, but is INTEGER(4)
  lock(lock_var, acquired_lock=non_bool)

  !ERROR: Must have INTEGER type, but is LOGICAL(4)
  lock(lock_var, stat=non_integer)

  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
  lock(lock_var, errmsg=non_char)

! rank mismatches

  !ERROR: Must be a scalar value, but is a rank-1 array
  lock(lock_array)

  !ERROR: Must be a scalar value, but is a rank-1 array
  lock(lock_var, acquired_lock=bool_array)

  !ERROR: Must be a scalar value, but is a rank-1 array
  lock(lock_var, stat=stat_array)

  !ERROR: Must be a scalar value, but is a rank-1 array
  lock(lock_var, errmsg=msg_array)

! corank mismatch

  !ERROR: to be determined
  lock(non_coarray_lock)

! C1173 - stat-variable and errmsg-variable shall not be a coindexed object

  !ERROR: to be determined
  lock(lock_var, stat=coindexed_int[1])

  !ERROR: to be determined
  lock(lock_var, errmsg=coindexed_msg[1])

  !ERROR: to be determined
  lock(lock_var, acquired_lock=coindexed_logical[1], stat=coindexed_int[1], errmsg=coindexed_msg[1])

! C1181 - No specifier shall appear more than once in a given lock-stat-list

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, acquired_lock=repeated_bool)

  !ERROR: to be determined
  lock(lock_var, stat=status, stat=repeated_stat)

  !ERROR: to be determined
  lock(lock_var, errmsg=error_message, errmsg=repeated_msg)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, acquired_lock=repeated_bool)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, stat=repeated_stat)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, errmsg=repeated_msg)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, acquired_lock=repeated_bool, stat=repeated_stat)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, acquired_lock=repeated_bool, errmsg=repeated_msg)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, stat=repeated_stat, errmsg=repeated_msg)

  !ERROR: to be determined
  lock(lock_var, acquired_lock=bool, stat=status, errmsg=error_message, acquired_lock=repeated_bool, stat=repeated_stat, errmsg=repeated_msg)

end program test_lock_stmt