1
1
! RUN: %python %S/test_errors.py %s %flang_fc1
2
- ! XFAIL: *
3
2
! This test checks for semantic errors in lock statements based on the
4
3
! statement specification in section 11.6.10 of the Fortran 2018 standard.
5
4
@@ -10,14 +9,16 @@ program test_lock_stmt
10
9
character (len= 128 ) error_message, msg_array(10 ), coindexed_msg[* ], repeated_msg
11
10
integer status, stat_array(10 ), coindexed_int[* ], non_bool, repeated_stat
12
11
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
14
15
type (event_type) :: not_lock_var[* ]
15
16
16
17
! ___ non-standard-conforming statements ___
17
18
18
19
! type mismatches
19
20
20
- ! ERROR: to be determined
21
+ ! ERROR: Lock variable must have type LOCK_TYPE from ISO_FORTRAN_ENV
21
22
lock(not_lock_var)
22
23
23
24
! ERROR: Must have LOGICAL type, but is INTEGER(4)
@@ -45,50 +46,65 @@ program test_lock_stmt
45
46
46
47
! corank mismatch
47
48
48
- ! ERROR: to be determined
49
- lock(non_coarray_lock)
49
+ lock(non_coarray_lock) ! caught above
50
50
51
51
! C1173 - stat-variable and errmsg-variable shall not be a coindexed object
52
52
53
- ! ERROR: to be determined
53
+ ! ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
54
54
lock(lock_var, stat= coindexed_int[1 ])
55
55
56
- ! ERROR: to be determined
56
+ ! ERROR: The stat-variable or errmsg-variable in a sync-stat-list may not be a coindexed object
57
57
lock(lock_var, errmsg= coindexed_msg[1 ])
58
58
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
60
61
lock(lock_var, acquired_lock= coindexed_logical[1 ], stat= coindexed_int[1 ], errmsg= coindexed_msg[1 ])
61
62
62
63
! C1181 - No specifier shall appear more than once in a given lock-stat-list
63
64
64
- ! ERROR: to be determined
65
+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
65
66
lock(lock_var, acquired_lock= bool, acquired_lock= repeated_bool)
66
67
67
- ! ERROR: to be determined
68
+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
68
69
lock(lock_var, stat= status, stat= repeated_stat)
69
70
70
- ! ERROR: to be determined
71
+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
71
72
lock(lock_var, errmsg= error_message, errmsg= repeated_msg)
72
73
73
- ! ERROR: to be determined
74
+ ! ERROR: Multiple ACQUIRED_LOCK specifiers
74
75
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool)
75
76
76
- ! ERROR: to be determined
77
+ ! ERROR: The stat-variable in a sync-stat-list may not be repeated
77
78
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, stat= repeated_stat)
78
79
79
- ! ERROR: to be determined
80
+ ! ERROR: The errmsg-variable in a sync-stat-list may not be repeated
80
81
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, errmsg= repeated_msg)
81
82
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
83
85
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool, stat= repeated_stat)
84
86
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
86
89
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool, errmsg= repeated_msg)
87
90
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
89
93
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, stat= repeated_stat, errmsg= repeated_msg)
90
94
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
92
98
lock(lock_var, acquired_lock= bool, stat= status, errmsg= error_message, acquired_lock= repeated_bool, stat= repeated_stat, errmsg= repeated_msg)
93
99
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
94
110
end program test_lock_stmt
0 commit comments