1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 ! This test checks for semantic errors in lock statements based on the
4 ! statement specification in section 11.6.10 of the Fortran 2018 standard.
7 use iso_fortran_env
, only
: lock_type
, event_type
10 character(len
=128) error_message
, msg_array(10), coindexed_msg
[*], repeated_msg
11 integer status
, stat_array(10), coindexed_int
[*], non_bool
, repeated_stat
12 logical non_integer
, bool
, bool_array(10), non_char
, coindexed_logical
[*], repeated_bool
13 type(lock_type
) :: lock_var
[*], lock_array(10)[*], non_coarray_lock
14 type(event_type
) :: not_lock_var
[*]
16 !___ non-standard-conforming statements ___
20 !ERROR: to be determined
23 !ERROR: Must have LOGICAL type, but is INTEGER(4)
24 lock(lock_var
, acquired_lock
=non_bool
)
26 !ERROR: Must have INTEGER type, but is LOGICAL(4)
27 lock(lock_var
, stat
=non_integer
)
29 !ERROR: Must have CHARACTER type, but is LOGICAL(4)
30 lock(lock_var
, errmsg
=non_char
)
34 !ERROR: Must be a scalar value, but is a rank-1 array
37 !ERROR: Must be a scalar value, but is a rank-1 array
38 lock(lock_var
, acquired_lock
=bool_array
)
40 !ERROR: Must be a scalar value, but is a rank-1 array
41 lock(lock_var
, stat
=stat_array
)
43 !ERROR: Must be a scalar value, but is a rank-1 array
44 lock(lock_var
, errmsg
=msg_array
)
48 !ERROR: to be determined
49 lock(non_coarray_lock
)
51 ! C1173 - stat-variable and errmsg-variable shall not be a coindexed object
53 !ERROR: to be determined
54 lock(lock_var
, stat
=coindexed_int
[1])
56 !ERROR: to be determined
57 lock(lock_var
, errmsg
=coindexed_msg
[1])
59 !ERROR: to be determined
60 lock(lock_var
, acquired_lock
=coindexed_logical
[1], stat
=coindexed_int
[1], errmsg
=coindexed_msg
[1])
62 ! C1181 - No specifier shall appear more than once in a given lock-stat-list
64 !ERROR: to be determined
65 lock(lock_var
, acquired_lock
=bool
, acquired_lock
=repeated_bool
)
67 !ERROR: to be determined
68 lock(lock_var
, stat
=status
, stat
=repeated_stat
)
70 !ERROR: to be determined
71 lock(lock_var
, errmsg
=error_message
, errmsg
=repeated_msg
)
73 !ERROR: to be determined
74 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, acquired_lock
=repeated_bool
)
76 !ERROR: to be determined
77 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, stat
=repeated_stat
)
79 !ERROR: to be determined
80 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, errmsg
=repeated_msg
)
82 !ERROR: to be determined
83 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, acquired_lock
=repeated_bool
, stat
=repeated_stat
)
85 !ERROR: to be determined
86 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, acquired_lock
=repeated_bool
, errmsg
=repeated_msg
)
88 !ERROR: to be determined
89 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, stat
=repeated_stat
, errmsg
=repeated_msg
)
91 !ERROR: to be determined
92 lock(lock_var
, acquired_lock
=bool
, stat
=status
, errmsg
=error_message
, acquired_lock
=repeated_bool
, stat
=repeated_stat
, errmsg
=repeated_msg
)
94 end program test_lock_stmt