[flang-commits] [flang] d0abde0 - [flang] Add two new semantics tests for `critical-construct`

Katherine Rasmussen via flang-commits flang-commits at lists.llvm.org
Thu Aug 10 10:51:27 PDT 2023


Author: Elliot Whitney
Date: 2023-08-10T10:45:48-07:00
New Revision: d0abde03543629f998b1a00f1c48b73bd459956f

URL: https://github.com/llvm/llvm-project/commit/d0abde03543629f998b1a00f1c48b73bd459956f
DIFF: https://github.com/llvm/llvm-project/commit/d0abde03543629f998b1a00f1c48b73bd459956f.diff

LOG: [flang] Add two new semantics tests for `critical-construct`

Add two new semantics tests for `critical-construct` that test
addition standard conforming and non stardard conforming statements

Reviewed By: ktras

Differential Revision: https://reviews.llvm.org/D157521

Added: 
    flang/test/Semantics/critical05.f90
    flang/test/Semantics/critical06.f90

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/critical05.f90 b/flang/test/Semantics/critical05.f90
new file mode 100644
index 00000000000000..b96e49714a7130
--- /dev/null
+++ b/flang/test/Semantics/critical05.f90
@@ -0,0 +1,38 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+program testcriticalconstruct
+  integer :: status
+  character(len=128) :: errormessage
+  integer :: total = 0
+  integer :: i
+
+  CRITICAL
+  END CRITICAL
+
+  Testname: Critical
+  End critical Testname
+
+  stat_variable: critical (STAT=status)
+  End critical stat_variable
+
+  errmsg_variable: critical (ERRMSG=errormessage)
+  End critical errmsg_variable
+
+  critical (ERRMSG=errormessage, STAT=status)
+  End critical
+
+  critical ()
+  end critical
+
+  critical (STAT=status)
+    do i = 1, this_image()
+        total = total + 1
+    end do
+    print *, "Total is: ", total
+  End critical
+
+  critical
+    10 continue
+    GO TO 10
+  End critical
+
+end program testcriticalconstruct

diff  --git a/flang/test/Semantics/critical06.f90 b/flang/test/Semantics/critical06.f90
new file mode 100644
index 00000000000000..d4a17ff98f8428
--- /dev/null
+++ b/flang/test/Semantics/critical06.f90
@@ -0,0 +1,12 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+program testcriticalconstruct
+
+  Start_name_only: Critical
+  !ERROR: CRITICAL construct name required but missing
+  End critical !C1117 in the Fortran 2018 standard
+
+  critical
+  !ERROR: CRITICAL construct name unexpected
+  end critical end_name_only !C1117 in Fortran 2018 standard
+
+end program


        


More information about the flang-commits mailing list