Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / lockstmt02.f90
blob0cd7bd3778f99a21ef89e8181c8e1bda422b2e2a
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! This test checks for semantic errors in lock statements based on the
3 ! statement specification in section 11.6.10 of the Fortran 2018 standard.
5 program test_lock_stmt
6 use iso_fortran_env, only: lock_type
7 implicit none
9 character(len=128) error_message
10 integer status
11 logical bool
12 type(lock_type) :: lock_var[*]
14 !___ non-standard-conforming statements ___
16 ! missing required lock-variable
18 !ERROR: expected '('
19 lock
21 !ERROR: expected '='
22 lock()
24 !ERROR: expected ')'
25 lock(acquired_lock=bool)
27 !ERROR: expected ')'
28 lock(stat=status)
30 !ERROR: expected ')'
31 lock(errmsg=error_message)
33 ! specifiers in lock-stat-list are not variables
35 !ERROR: expected ')'
36 lock(lock_var, acquired_lock=.true.)
38 !ERROR: expected ')'
39 lock(lock_var, stat=1)
41 !ERROR: expected ')'
42 lock(lock_var, errmsg='c')
44 ! specifier typos
46 !ERROR: expected ')'
47 lock(lock_var, acquiredlock=bool, stat=status, errmsg=error_message)
49 !ERROR: expected ')'
50 lock(lock_var, acquired_lock=bool, status=status, errmsg=error_message)
52 !ERROR: expected ')'
53 lock(lock_var, acquired_lock=bool, stat=status, errormsg=error_message)
55 end program test_lock_stmt