11! RUN: %python %S/test_errors.py %s %flang_fc1
2- ! XFAIL: *
32! This test checks for semantic errors in lock statements based on the
43! statement specification in section 11.6.10 of the Fortran 2018 standard.
54
@@ -10,14 +9,16 @@ program test_lock_stmt
109 character (len= 128 ) error_message, msg_array(10 ), coindexed_msg[* ], repeated_msg
1110 integer status, stat_array(10 ), coindexed_int[* ], non_bool, repeated_stat
1211 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
12+ type (lock_type) :: lock_var[* ], lock_array(10 )[* ]
13+ ! ERROR: Variable 'non_coarray_lock' with EVENT_TYPE or LOCK_TYPE must be a coarray
14+ type (lock_type) :: non_coarray_lock
1415 type (event_type) :: not_lock_var[* ]
1516
1617 ! ___ non-standard-conforming statements ___
1718
1819! type mismatches
1920
20- ! ERROR: to be determined
21+ ! ERROR: Lock variable must have type LOCK_TYPE from ISO_FORTRAN_ENV
2122 lock(not_lock_var)
2223
2324 ! ERROR: Must have LOGICAL type, but is INTEGER(4)
@@ -45,50 +46,65 @@ program test_lock_stmt
4546
4647! corank mismatch
4748
48- ! ERROR: to be determined
49- lock(non_coarray_lock)
49+ lock(non_coarray_lock) ! caught above
5050
5151! C1173 - stat-variable and errmsg-variable shall not be a coindexed object
5252
53- ! ERROR: to be determined
53+ ! ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
5454 lock(lock_var, stat= coindexed_int[1 ])
5555
56- ! ERROR: to be determined
56+ ! ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
5757 lock(lock_var, errmsg= coindexed_msg[1 ])
5858
59- ! ERROR: to be determined
59+ ! ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
60+ ! ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
6061 lock(lock_var, acquired_lock= coindexed_logical[1 ], stat= coindexed_int[1 ], errmsg= coindexed_msg[1 ])
6162
6263! C1181 - No specifier shall appear more than once in a given lock-stat-list
6364
64- ! ERROR: to be determined
65+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
6566 lock(lock_var, acquired_lock= bool, acquired_lock= repeated_bool)
6667
67- ! ERROR: to be determined
68+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
6869 lock(lock_var, stat= status, stat= repeated_stat)
6970
70- ! ERROR: to be determined
71+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
7172 lock(lock_var, errmsg= error_message, errmsg= repeated_msg)
7273
73- ! ERROR: to be determined
74+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
7475 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool)
7576
76- ! ERROR: to be determined
77+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
7778 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, stat= repeated_stat)
7879
79- ! ERROR: to be determined
80+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
8081 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, errmsg= repeated_msg)
8182
82- ! ERROR: to be determined
83+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
84+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
8385 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool, stat= repeated_stat)
8486
85- ! ERROR: to be determined
87+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
88+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
8689 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool, errmsg= repeated_msg)
8790
88- ! ERROR: to be determined
91+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
92+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
8993 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, stat= repeated_stat, errmsg= repeated_msg)
9094
91- ! ERROR: to be determined
95+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
96+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
97+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
9298 lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool, stat= repeated_stat, errmsg= repeated_msg)
9399
100+ contains
101+ subroutine lockit (x )
102+ type (lock_type), intent (in ) :: x[* ]
103+ ! ERROR: Lock variable is not definable
104+ ! BECAUSE: 'x' is an INTENT(IN) dummy argument
105+ lock(x)
106+ ! ERROR: Lock variable is not definable
107+ ! BECAUSE: 'x' is an INTENT(IN) dummy argument
108+ unlock(x)
109+ end
94110end program test_lock_stmt
0 commit comments