[flang-commits] [flang] 565f5df - [flang] test conforming & non-conforming lcobound

Damian Rouson via flang-commits flang-commits at lists.llvm.org
Wed May 18 16:57:27 PDT 2022


Author: Damian Rouson
Date: 2022-05-18T16:55:48-07:00
New Revision: 565f5dfa1f3ea52637fcfec4babd4a406d2e4c03

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

LOG: [flang] test conforming & non-conforming lcobound

Add a test with standard-conforming  non-conforming lcobound()
intrinsic function invocations.  Also test that several
non-conforming lcobound() invocations generate the correct error
messages.

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

Added: 
    flang/test/Semantics/lcobound.f90

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/flang/test/Semantics/lcobound.f90 b/flang/test/Semantics/lcobound.f90
new file mode 100644
index 0000000000000..82fe21da09a07
--- /dev/null
+++ b/flang/test/Semantics/lcobound.f90
@@ -0,0 +1,77 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! XFAIL: *
+! Check for semantic errors in lcobound() function references
+
+program lcobound_tests
+  use iso_c_binding, only : c_int32_t
+  implicit none
+
+  integer n, i, array(1), non_coarray(1), scalar_coarray[*], array_coarray(1)[*], non_constant, scalar
+  logical non_integer
+  integer, allocatable :: lcobounds(:)
+
+  !___ standard-conforming statement with no optional arguments present ___
+  lcobounds = lcobound(scalar_coarray)
+  lcobounds = lcobound(array_coarray)
+  lcobounds = lcobound(coarray=scalar_coarray)
+
+  !___ standard-conforming statements with optional dim argument present ___
+  n = lcobound(scalar_coarray, 1)
+  n = lcobound(scalar_coarray, dim=1)
+  n = lcobound(coarray=scalar_coarray, dim=1)
+  n = lcobound( dim=1, coarray=scalar_coarray)
+
+  !___ standard-conforming statements with optional kind argument present ___
+  n = lcobound(scalar_coarray, 1, c_int32_t)
+
+  n = lcobound(scalar_coarray, 1, kind=c_int32_t)
+
+  n = lcobound(scalar_coarray, dim=1, kind=c_int32_t)
+  n = lcobound(scalar_coarray, kind=c_int32_t, dim=1)
+
+  lcobounds = lcobound(scalar_coarray, kind=c_int32_t)
+
+  lcobounds = lcobound(coarray=scalar_coarray, kind=c_int32_t)
+  lcobounds = lcobound(kind=c_int32_t, coarray=scalar_coarray)
+
+  n = lcobound(coarray=scalar_coarray, dim=1, kind=c_int32_t)
+  n = lcobound(dim=1, coarray=scalar_coarray, kind=c_int32_t)
+  n = lcobound(kind=c_int32_t, coarray=scalar_coarray, dim=1)
+  n = lcobound(dim=1, kind=c_int32_t, coarray=scalar_coarray)
+  n = lcobound(kind=c_int32_t, dim=1, coarray=scalar_coarray)
+
+  !___ non-conforming statements ___
+  n = lcobound(scalar_coarray, dim=1)
+  n = lcobound(array_coarray, dim=2)
+  scalar = lcobound(scalar_coarray)
+
+  n = lcobound(dim=i)
+
+  n = lcobound(scalar_coarray, non_integer)
+
+  n = lcobound(scalar_coarray, dim=non_integer)
+
+  lcobounds = lcobound(scalar_coarray, kind=non_integer)
+  lcobounds = lcobound(scalar_coarray, kind=non_constant)
+
+  n = lcobound(dim=i, kind=c_int32_t)
+
+  n = lcobound(coarray=scalar_coarray, i)
+
+  lcobounds = lcobound(3.4)
+
+  n = lcobound(scalar_coarray, i, c_int32_t, 0)
+
+  lcobounds = lcobound(coarray=non_coarray)
+
+  n = lcobound(scalar_coarray, i, kind=non_integer)
+
+  n = lcobound(scalar_coarray, array )
+
+  lcobounds = lcobound(c=scalar_coarray)
+
+  n = lcobound(scalar_coarray, dims=i)
+
+  n = lcobound(scalar_coarray, i, kinds=c_int32_t)
+
+end program lcobound_tests


        


More information about the flang-commits mailing list