[flang-commits] [PATCH] D123747: Test conforming & non-conforming lcobound intrinsic function semantics
Damian Rouson via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Apr 13 17:14:30 PDT 2022
rouson created this revision.
rouson added reviewers: ktras, pmccormick.
rouson added projects: Flang, LLVM.
Herald added a subscriber: jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
rouson requested review of this revision.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123747
Files:
flang/test/Semantics/lcobound.f90
Index: flang/test/Semantics/lcobound.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/lcobound.f90
@@ -0,0 +1,85 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Check for semantic errors in lcobound() function calls
+
+program lcobound_tests
+ use iso_c_binding, only : c_int32_t
+ implicit none
+
+ integer n, i, array(1), non_coarray(1), co_array[*]
+ logical non_integer
+
+ !___ standard-conforming statement with no optional arguments present ___
+ n = lcobound(co_array)
+ n = lcobound(coarray=co_array)
+
+ !___ standard-conforming statements with optional dim argument present ___
+ n = lcobound(co_array, 1)
+ n = lcobound(co_array, dim=1)
+ n = lcobound(coarray=co_array, dim=1)
+ n = lcobound( dim=1, coarray=co_array)
+
+ !___ standard-conforming statements with optional kind argument present ___
+ n = lcobound(co_array, 1, c_int32_t)
+
+ n = lcobound(co_array, 1, kind=c_int32_t)
+
+ n = lcobound(co_array, dim=1, kind=c_int32_t)
+ n = lcobound(co_array, kind=c_int32_t, dim=1)
+
+ n = lcobound(co_array, kind=c_int32_t)
+
+ n = lcobound(coarray=co_array, kind=c_int32_t)
+ n = lcobound(kind=c_int32_t, coarray=co_array)
+
+ n = lcobound(coarray=co_array, dim=1, kind=c_int32_t)
+ n = lcobound(dim=1, coarray=co_array, kind=c_int32_t)
+ n = lcobound(kind=c_int32_t, coarray=co_array, dim=1)
+ n = lcobound(dim=1, kind=c_int32_t, coarray=co_array)
+ n = lcobound(kind=c_int32_t, dim=1, coarray=co_array)
+
+ !___ non-conforming statements ___
+
+ !ERROR: TBD
+ n = lcobound(dim=i)
+
+ !ERROR: TBD
+ n = lcobound(co_array, non_integer)
+
+ !ERROR: TBD
+ n = lcobound(co_array, dim=non_integer)
+
+ !ERROR: TBD
+ n = lcobound(co_array, kind=non_integer)
+
+ !ERROR: TBD
+ n = lcobound(dim=i, kind=c_int32_t)
+
+ !ERROR: TBD
+ n = lcobound(coarray=co_array, i)
+
+ ! incorrectly typed argument
+ !ERROR: TBD
+ n = lcobound(3.4)
+
+ !ERROR: TBD
+ n = lcobound(co_array, i, c_int32_t, 0)
+
+ !ERROR: TBD
+ n = lcobound(coarray=non_coarray)
+
+ !ERROR: TBD
+ n = lcobound(co_array, i, kind=non_integer)
+
+ !ERROR: TBD
+ n = lcobound(co_array, array )
+
+ !ERROR: TBD
+ n = lcobound(c=co_array)
+
+ !ERROR: TBD
+ n = lcobound(co_array, dims=i)
+
+ !ERROR: TBD
+ n = lcobound(co_array, i, kinds=c_int32_t)
+
+end program lcobound_tests
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123747.422699.patch
Type: text/x-patch
Size: 2366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220414/cd85186d/attachment-0001.bin>
More information about the flang-commits
mailing list