[flang-commits] [PATCH] D113084: [flang] Add a semantics test for co_broadcast

Damian Rouson via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Dec 1 16:23:12 PST 2021


rouson updated this revision to Diff 391162.
rouson added a comment.

As suggested in Diff D113086 <https://reviews.llvm.org/D113086>, the updated diff

1. Removes trailing whitespace if present.
2. Cites the section of the standard that defines the co_broadcast interface.
3. Adds a check for an error in which the first co_broadcast argument is coindexed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113084/new/

https://reviews.llvm.org/D113084

Files:
  flang/test/Semantics/collectives04.f90


Index: flang/test/Semantics/collectives04.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/collectives04.f90
@@ -0,0 +1,56 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! XFAIL: *
+! This test checks for semantic errors in co_broadcast subroutine calls based on
+! the co_broadcast interface defined in section 16.9.46 of the Fortran 2018 standard.
+! To Do: add co_broadcast to the evaluation stage
+
+program main
+  implicit none
+
+  type foo_t
+  end type
+
+  type(foo_t) foo
+  type(foo_t) bar(1,1)
+  integer i, status
+  logical bool
+  complex z
+  real vector(1)
+  real array(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1)
+  character(len=1) string, message
+  integer coindexed[*]
+
+  ! correct calls, should produce no errors
+  call co_broadcast(i,   1)
+  call co_broadcast(i,   1,              status)
+  call co_broadcast(i,   1,              stat=status)
+  call co_broadcast(i,   1,                           errmsg=message)
+  call co_broadcast(i,   1,              stat=status, errmsg=message)
+  call co_broadcast(i,   source_image=1, stat=status, errmsg=message)
+  call co_broadcast(a=i, source_image=1, stat=status, errmsg=message)
+
+  call co_broadcast(z, source_image=1, stat=status, errmsg=message)
+  call co_broadcast(bool, source_image=1, stat=status, errmsg=message)
+  call co_broadcast(array,  source_image=1, stat=status, errmsg=message)
+  call co_broadcast(vector, source_image=1, stat=status, errmsg=message)
+  call co_broadcast(string, source_image=1, stat=status, errmsg=message)
+  call co_broadcast(foo,    source_image=1, stat=status, errmsg=message)
+  call co_broadcast(bar,    source_image=1, stat=status, errmsg=message)
+
+  ! incorrect type for the stat= argument
+  !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)'
+  call co_broadcast(i, 1, message)
+
+  ! too many arguments to the co_broadcast() call
+  !ERROR: too many actual arguments for intrinsic 'co_broadcast'
+  call co_broadcast(i, source_image=1, stat=status, errmsg=message, 3.4)
+
+  ! keyword argument with incorrect type
+  !ERROR: unknown keyword argument to intrinsic 'co_broadcast'
+  call co_broadcast(fake=3.4)
+
+  ! keyword argument with incorrect type
+  !ERROR: (message to be determined)
+  call co_broadcast(coindexed[1], source_image=1)
+
+end program


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113084.391162.patch
Type: text/x-patch
Size: 2370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211202/4e72b7f7/attachment-0001.bin>


More information about the flang-commits mailing list