[flang-commits] [flang] 21dceb3 - [flang] Split up synchronization, event, and error stop stmt tests

Katherine Rasmussen via flang-commits flang-commits at lists.llvm.org
Sun Aug 28 10:41:41 PDT 2022


Author: Katherine Rasmussen
Date: 2022-08-28T10:36:02-07:00
New Revision: 21dceb3ca67cdc0e05b95e1d229bd01a8cd29f60

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

LOG: [flang] Split up synchronization, event, and error stop stmt tests

Splitting up the tests for the synchronization statements,
event statements, and error stop statement allow for some of the
errors which are hidden by other errors, to be caught in the test.
This then reveals which invalid code does produce errors and which
does not produce errors.

Added: 
    flang/test/Semantics/error_stop1a.f90
    flang/test/Semantics/error_stop1b.f90
    flang/test/Semantics/event01a.f90
    flang/test/Semantics/event01b.f90
    flang/test/Semantics/event02a.f90
    flang/test/Semantics/event02b.f90
    flang/test/Semantics/synchronization01a.f90
    flang/test/Semantics/synchronization01b.f90
    flang/test/Semantics/synchronization02a.f90
    flang/test/Semantics/synchronization02b.f90
    flang/test/Semantics/synchronization03a.f90
    flang/test/Semantics/synchronization03b.f90
    flang/test/Semantics/synchronization04a.f90
    flang/test/Semantics/synchronization04b.f90

Modified: 
    

Removed: 
    flang/test/Semantics/error_stop.f90
    flang/test/Semantics/event01.f90
    flang/test/Semantics/event02.f90
    flang/test/Semantics/synchronization01.f90
    flang/test/Semantics/synchronization02.f90
    flang/test/Semantics/synchronization03.f90
    flang/test/Semantics/synchronization04.f90


################################################################################
diff  --git a/flang/test/Semantics/error_stop.f90 b/flang/test/Semantics/error_stop1a.f90
similarity index 77%
rename from flang/test/Semantics/error_stop.f90
rename to flang/test/Semantics/error_stop1a.f90
index 925cdf4ca8d06..cb90d9644c93c 100644
--- a/flang/test/Semantics/error_stop.f90
+++ b/flang/test/Semantics/error_stop1a.f90
@@ -14,7 +14,7 @@ program test_error_stop
   !___ standard-conforming statements ____________________________
   error stop
 
-  !___ standard-conforming statement with stop-code ______________
+  !___ standard-conforming statements with stop-code ______________
   error stop int_code
   error stop 5
   error stop (5)
@@ -32,7 +32,7 @@ program test_error_stop
   error stop array_coarray(1)
   error stop array_coarray(1)[1]
 
-  !___ standard-conforming statement with stop-code and quiet= ___
+  !___ standard-conforming statements with stop-code and quiet= ___
   error stop int_code, quiet=bool
   error stop int_code, quiet=logical_array(1)
   error stop int_code, quiet=logical_coarray
@@ -40,36 +40,12 @@ program test_error_stop
   error stop int_code, quiet=.true.
   error stop (int_code), quiet=.false.
 
-  !___ non-standard-conforming statement _________________________
+  !___ non-standard-conforming statements _________________________
 
   ! unknown stop-code
   !ERROR: expected execution part construct
   error stop code=int_code
 
-  ! invalid stop-code typing
-  error stop non_integer
-
-  ! invalid stop-code typing
-  error stop non_character
-
-  ! stop-code must be of default kind
-  error stop non_default_int_kind
-
-  ! stop-code must be of default kind
-  error stop non_default_char_kind
-
-  ! stop-code must be scalar
-  error stop char_array
-
-  ! stop-code must be scalar
-  error stop array_coarray[1]
-
-  ! invalid quiet= typing
-  error stop int_code, quiet=non_logical
-
-  ! quiet= must be scalar
-  error stop int_code, quiet=logical_array
-
   ! missing 'quiet='
   !ERROR: expected execution part construct
   error stop int_code, bool

diff  --git a/flang/test/Semantics/error_stop1b.f90 b/flang/test/Semantics/error_stop1b.f90
new file mode 100644
index 0000000000000..355a049560102
--- /dev/null
+++ b/flang/test/Semantics/error_stop1b.f90
@@ -0,0 +1,43 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for semantic errors in error stop statements based on the
+! statement specification in section 11.4 of the Fortran 2018 standard.
+! The errors in this test would be hidden by the errors in
+! the test error_stop01a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_error_stop
+  implicit none
+
+  integer int_code, int_array(1), int_coarray[*], array_coarray(1)[*]
+  integer(kind=1) non_default_int_kind
+  character(len=128) char_code, char_array(1), char_coarray[*], non_logical
+  character(kind=4, len=128) non_default_char_kind
+  logical bool, logical_array(1), logical_coarray[*], non_integer, non_character
+
+  !___ non-standard-conforming statements _________________________
+
+  !ERROR: Stop code must be of INTEGER or CHARACTER type
+  error stop non_integer
+
+  !ERROR: Stop code must be of INTEGER or CHARACTER type
+  error stop non_character
+
+  !ERROR: INTEGER stop code must be of default kind
+  error stop non_default_int_kind
+
+  !ERROR: CHARACTER stop code must be of default kind
+  error stop non_default_char_kind
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  error stop char_array
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  error stop array_coarray[1]
+
+  !ERROR: Must have LOGICAL type, but is CHARACTER(KIND=1,LEN=128_8)
+  error stop int_code, quiet=non_logical
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  error stop int_code, quiet=logical_array
+
+end program test_error_stop

diff  --git a/flang/test/Semantics/event01.f90 b/flang/test/Semantics/event01a.f90
similarity index 62%
rename from flang/test/Semantics/event01.f90
rename to flang/test/Semantics/event01a.f90
index 804c35e291e89..101131542d0b1 100644
--- a/flang/test/Semantics/event01.f90
+++ b/flang/test/Semantics/event01a.f90
@@ -14,7 +14,7 @@ program test_event_post
   character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
   logical invalid_type
 
-  !___ standard-conforming statement ___
+  !___ standard-conforming statements ___
 
   event post(concert)
   event post(concert[1])
@@ -24,22 +24,10 @@ program test_event_post
   event post(concert,                   errmsg=error_message)
   event post(concert, stat=sync_status, errmsg=error_message)
 
-  !___ non-standard-conforming statement ___
+  !___ non-standard-conforming statements ___
 
   !______ invalid event-variable ____________________________
 
-  ! event-variable must be event_type
-  event post(non_event)
-
-  ! event-variable must be a coarray
-  event post(non_coarray)
-
-  ! event-variable must be a scalar variable
-  event post(occurrences)
-
-  ! event-variable must be a scalar variable
-  event post(occurrences[1])
-
   ! event-variable has an unknown keyword argument
   !ERROR: expected ')'
   event post(event=concert)
@@ -50,12 +38,6 @@ program test_event_post
   !ERROR: expected ')'
   event post(concert, status=sync_status)
 
-  ! Stat-variable must an integer scalar
-  event post(concert, stat=invalid_type)
-
-  ! Stat-variable must an integer scalar
-  event post(concert, stat=non_scalar)
-
   ! Invalid sync-stat-list: missing stat-variable
   !ERROR: expected ')'
   event post(concert, stat)
@@ -70,9 +52,6 @@ program test_event_post
   !ERROR: expected ')'
   event post(concert, errormsg=error_message)
 
-  ! Invalid errmsg-variable argument typing
-  event post(concert, errmsg=invalid_type)
-
   ! Invalid sync-stat-list: missing 'errmsg='
   !ERROR: expected ')'
   event post(concert, error_message)
@@ -91,20 +70,4 @@ program test_event_post
   !ERROR: expected ')'
   event post(concert, occurrences(1), stat=sync_status, errmsg=error_message)
 
-  !______ invalid sync-stat-lists: redundant sync-stat-list ____________
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  event post(concert, stat=sync_status, stat=superfluous_stat)
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  event post(concert, errmsg=error_message, errmsg=superfluous_errmsg)
-
-  !______ invalid sync-stat-lists: coindexed stat-variable ____________
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  event post(concert, stat=co_indexed_integer[1])
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  event post(concert, errmsg=co_indexed_character[1])
-
 end program test_event_post

diff  --git a/flang/test/Semantics/event01b.f90 b/flang/test/Semantics/event01b.f90
new file mode 100644
index 0000000000000..7cf374fbcc84e
--- /dev/null
+++ b/flang/test/Semantics/event01b.f90
@@ -0,0 +1,65 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for semantic errors in event post statements based on the
+! statement specification in section 11.6.7 of the Fortran 2018 standard.
+! Some of the errors in this test would be hidden by the errors in
+! the test event01a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_event_post
+  use iso_fortran_env, only : event_type
+  implicit none
+
+  ! event_type variables must be coarrays
+  type(event_type) non_coarray
+
+  type(event_type) concert[*], occurrences(2)[*]
+  integer non_event[*], sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
+  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
+  logical invalid_type
+
+  !___ non-standard-conforming statements ___
+
+  !______ invalid event-variable ____________________________
+
+  ! event-variable must be event_type
+  event post(non_event)
+
+  ! event-variable must be a coarray
+  event post(non_coarray)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event post(occurrences)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event post(occurrences[1])
+
+  !______ invalid sync-stat-lists: invalid stat= ____________
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  event post(concert, stat=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event post(concert, stat=non_scalar)
+
+  !______ invalid sync-stat-lists: invalid errmsg= ____________
+
+  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
+  event post(concert, errmsg=invalid_type)
+
+  !______ invalid sync-stat-lists: redundant sync-stat-list ____________
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  event post(concert, stat=sync_status, stat=superfluous_stat)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  event post(concert, errmsg=error_message, errmsg=superfluous_errmsg)
+
+  !______ invalid sync-stat-lists: coindexed stat-variable ____________
+
+  ! Check constraint C1173 from the Fortran 2018 standard
+  event post(concert, stat=co_indexed_integer[1])
+
+  ! Check constraint C1173 from the Fortran 2018 standard
+  event post(concert, errmsg=co_indexed_character[1])
+
+end program test_event_post

diff  --git a/flang/test/Semantics/event02.f90 b/flang/test/Semantics/event02a.f90
similarity index 61%
rename from flang/test/Semantics/event02.f90
rename to flang/test/Semantics/event02a.f90
index cb22d8d1cc968..f0cba6b63adbd 100644
--- a/flang/test/Semantics/event02.f90
+++ b/flang/test/Semantics/event02a.f90
@@ -14,7 +14,7 @@ program test_event_wait
   character(len=128) error_message, non_scalar_char(1), co_indexed_character[*], superfluous_errmsg
   logical invalid_type
 
-  !_______________________ standard-conforming statement ___________________________
+  !_______________________ standard-conforming statements ___________________________
 
   event wait(concert)
   event wait(occurrences(1))
@@ -28,25 +28,10 @@ program test_event_wait
   event wait(concert,                        stat=sync_status, errmsg=error_message)
   event wait(concert, until_count=threshold, stat=sync_status, errmsg=error_message)
 
-  !____________________ non-standard-conforming statement __________________________
+  !____________________ non-standard-conforming statements __________________________
 
   !_________________________ invalid event-variable ________________________________
 
-  ! event-variable must be event_type
-  event wait(non_event)
-
-  ! event-variable must be a coarray
-  event wait(non_coarray)
-
-  ! event-variable must not be coindexed
-  event wait(concert[1])
-
-  ! event-variable must not be coindexed
-  event wait(occurrences(1)[1])
-
-  ! event-variable must be a scalar variable
-  event wait(occurrences)
-
   ! event-variable has an unknown expression
   !ERROR: expected ')'
   event wait(event=concert)
@@ -57,12 +42,6 @@ program test_event_wait
   !ERROR: expected ')'
   event wait(concert, until_amount=threshold)
 
-  ! Until-spec must be an integer scalar
-  event wait(concert, until_count=invalid_type)
-
-  ! Until-spec must be an integer scalar
-  event wait(concert, until_count=non_scalar)
-
   ! Invalid until-spec: missing until-spec variable
   !ERROR: expected ')'
   event wait(concert, until_count)
@@ -77,12 +56,6 @@ program test_event_wait
   !ERROR: expected ')'
   event wait(concert, status=sync_status)
 
-  ! Stat-variable must be an integer scalar
-  event wait(concert, stat=invalid_type)
-
-  ! Stat-variable must be an integer scalar
-  event wait(concert, stat=non_scalar)
-
   ! Invalid sync-stat-list: missing stat-variable
   !ERROR: expected ')'
   event wait(concert, stat)
@@ -97,12 +70,6 @@ program test_event_wait
   !ERROR: expected ')'
   event wait(concert, errormsg=error_message)
 
-  ! Errmsg-variable must be a character scalar
-  event wait(concert, errmsg=invalid_type)
-
-  ! Errmsg-variable must be a character scalar
-  event wait(concert, errmsg=non_scalar_char)
-
   ! Invalid sync-stat-list: missing 'errmsg='
   !ERROR: expected ')'
   event wait(concert, error_message)
@@ -119,23 +86,4 @@ program test_event_wait
   !ERROR: expected ')'
   event wait(concert, occurrences(1), stat=sync_status, errmsg=error_message)
 
-  !______ invalid event-wait-spec-lists: redundant event-wait-spec-list ____________
-
-  ! No specifier shall appear more than once in a given event-wait-spec-list
-  event wait(concert, until_count=threshold, until_count=indexed(1))
-
-  ! No specifier shall appear more than once in a given event-wait-spec-list
-  event wait(concert, stat=sync_status, stat=superfluous_stat)
-
-  ! No specifier shall appear more than once in a given event-wait-spec-list
-  event wait(concert, errmsg=error_message, errmsg=superfluous_errmsg)
-
-  !_____________ invalid sync-stat-lists: coindexed stat-variable __________________
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  event wait(concert, stat=co_indexed_integer[1])
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  event wait(concert, errmsg=co_indexed_character[1])
-
 end program test_event_wait

diff  --git a/flang/test/Semantics/event02b.f90 b/flang/test/Semantics/event02b.f90
new file mode 100644
index 0000000000000..8aa53bd96213c
--- /dev/null
+++ b/flang/test/Semantics/event02b.f90
@@ -0,0 +1,82 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for semantic errors in event wait statements based on the
+! statement specification in section 11.6.8 of the Fortran 2018 standard.
+! Some of the errors in this test would be hidden by the errors in
+! the test event02a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_event_wait
+  use iso_fortran_env, only : event_type
+  implicit none
+
+  ! event_type variables must be coarrays
+  type(event_type) non_coarray
+
+  type(event_type) concert[*], occurrences(2)[*]
+  integer threshold, indexed(1), non_event[*], sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
+  character(len=128) error_message, non_scalar_char(1), co_indexed_character[*], superfluous_errmsg
+  logical invalid_type
+
+  !____________________ non-standard-conforming statements __________________________
+
+  !_________________________ invalid event-variable ________________________________
+
+  ! event-variable must be event_type
+  event wait(non_event)
+
+  ! event-variable must be a coarray
+  event wait(non_coarray)
+
+  ! event-variable must not be coindexed
+  event wait(concert[1])
+
+  ! event-variable must not be coindexed
+  event wait(occurrences(1)[1])
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event wait(occurrences)
+
+  !_____________ invalid event-wait-spec-lists: invalid until-spec _________________
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  event wait(concert, until_count=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event wait(concert, until_count=non_scalar)
+
+  !_________________ invalid sync-stat-lists: invalid stat= ________________________
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  event wait(concert, stat=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event wait(concert, stat=non_scalar)
+
+  !________________ invalid sync-stat-lists: invalid errmsg= _______________________
+
+  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
+  event wait(concert, errmsg=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  event wait(concert, errmsg=non_scalar_char)
+
+  !______ invalid event-wait-spec-lists: redundant event-wait-spec-list ____________
+
+  ! No specifier shall appear more than once in a given event-wait-spec-list
+  event wait(concert, until_count=threshold, until_count=indexed(1))
+
+  ! No specifier shall appear more than once in a given event-wait-spec-list
+  event wait(concert, stat=sync_status, stat=superfluous_stat)
+
+  ! No specifier shall appear more than once in a given event-wait-spec-list
+  event wait(concert, errmsg=error_message, errmsg=superfluous_errmsg)
+
+  !_____________ invalid sync-stat-lists: coindexed stat-variable __________________
+
+  ! Check constraint C1173 from the Fortran 2018 standard
+  event wait(concert, stat=co_indexed_integer[1])
+
+  ! Check constraint C1173 from the Fortran 2018 standard
+  event wait(concert, errmsg=co_indexed_character[1])
+
+end program test_event_wait

diff  --git a/flang/test/Semantics/synchronization01.f90 b/flang/test/Semantics/synchronization01.f90
deleted file mode 100644
index 5281c68fbb9ae..0000000000000
--- a/flang/test/Semantics/synchronization01.f90
+++ /dev/null
@@ -1,80 +0,0 @@
-! RUN: %python %S/test_errors.py %s %flang_fc1
-! XFAIL: *
-! This test checks for semantic errors in sync all statements based on the
-! statement specification in section 11.6.3 of the Fortran 2018 standard.
-
-program test_sync_all
-  implicit none
-
-  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
-  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
-  logical invalid_type
-  
-  !___ standard-conforming statement ___
-
-  sync all
-  sync all(stat=sync_status)
-  sync all(                  errmsg=error_message)
-  sync all(stat=sync_status, errmsg=error_message)
- 
-  !___ non-standard-conforming statement ___
-
-  !______ invalid sync-stat-lists: invalid stat= ____________
-
-  !ERROR: expected execution part construct
-  sync all(status=sync_status)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync all(stat=invalid_type)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync all(stat=non_scalar)
-
-  ! Invalid sync-stat-list: missing stat-variable
-  !ERROR: expected execution part construct
-  sync all(stat)
-
-  ! Invalid sync-stat-list: missing 'stat='
-  !ERROR: expected execution part construct
-  sync all(sync_status)
-
-  !______ invalid sync-stat-lists: invalid errmsg= ____________
-
-  ! Invalid errmsg-variable keyword
-  !ERROR: expected execution part construct
-  sync all(errormsg=error_message)
-
-  !ERROR: TBD
-  sync all(errmsg=invalid_type)
-
-  ! Invalid sync-stat-list: missing 'errmsg='
-  !ERROR: expected execution part construct
-  sync all(error_message)
-
-  ! Invalid sync-stat-list: missing errmsg-variable
-  !ERROR: expected execution part construct
-  sync all(errmsg)
-
-  !______ invalid sync-stat-lists: redundant sync-stat-list ____________
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync all(stat=sync_status, stat=superfluous_stat)
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync all(errmsg=error_message, errmsg=superfluous_errmsg)
- 
-  !______ invalid sync-stat-lists: coindexed stat-variable ____________
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync all(stat=co_indexed_integer[1])
- 
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync all(errmsg=co_indexed_character[1])
-
-end program test_sync_all

diff  --git a/flang/test/Semantics/synchronization01a.f90 b/flang/test/Semantics/synchronization01a.f90
new file mode 100644
index 0000000000000..4d4b68e26460e
--- /dev/null
+++ b/flang/test/Semantics/synchronization01a.f90
@@ -0,0 +1,48 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for errors in sync all statements based on the
+! statement specification in section 11.6.3 of the Fortran 2018 standard.
+
+program test_sync_all
+  implicit none
+
+  integer sync_status
+  character(len=128) error_message
+
+  !___ standard-conforming statement ___
+
+  sync all
+  sync all()
+  sync all(stat=sync_status)
+  sync all(                  errmsg=error_message)
+  sync all(stat=sync_status, errmsg=error_message)
+
+  !___ non-standard-conforming statement ___
+
+  !______ invalid sync-stat-lists: invalid stat= ____________
+
+  !ERROR: expected execution part construct
+  sync all(status=sync_status)
+
+  ! Invalid sync-stat-list: missing stat-variable
+  !ERROR: expected execution part construct
+  sync all(stat)
+
+  ! Invalid sync-stat-list: missing 'stat='
+  !ERROR: expected execution part construct
+  sync all(sync_status)
+
+  !______ invalid sync-stat-lists: invalid errmsg= ____________
+
+  ! Invalid errmsg-variable keyword
+  !ERROR: expected execution part construct
+  sync all(errormsg=error_message)
+
+  ! Invalid sync-stat-list: missing 'errmsg='
+  !ERROR: expected execution part construct
+  sync all(error_message)
+
+  ! Invalid sync-stat-list: missing errmsg-variable
+  !ERROR: expected execution part construct
+  sync all(errmsg)
+
+end program test_sync_all

diff  --git a/flang/test/Semantics/synchronization01b.f90 b/flang/test/Semantics/synchronization01b.f90
new file mode 100644
index 0000000000000..d25250ea7cf2d
--- /dev/null
+++ b/flang/test/Semantics/synchronization01b.f90
@@ -0,0 +1,37 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for semantic errors in sync all statements.
+! Some of the errors in this test would be hidden by the errors in
+! the test synchronization01a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_sync_all
+  implicit none
+
+  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
+  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
+  logical invalid_type
+
+  !___ non-standard-conforming statements ___
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  sync all(stat=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  sync all(stat=non_scalar)
+
+  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
+  sync all(errmsg=invalid_type)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync all(stat=sync_status, stat=superfluous_stat)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync all(errmsg=error_message, errmsg=superfluous_errmsg)
+
+  ! Fortran 2018 standard C1173: `stat` shall not be coindexed
+  sync all(stat=co_indexed_integer[1])
+
+  ! Fortran 2018 standard C1173: `errmsg` shall not be coindexed
+  sync all(errmsg=co_indexed_character[1])
+
+end program test_sync_all

diff  --git a/flang/test/Semantics/synchronization02.f90 b/flang/test/Semantics/synchronization02a.f90
similarity index 52%
rename from flang/test/Semantics/synchronization02.f90
rename to flang/test/Semantics/synchronization02a.f90
index 1a2a4b9f18864..27d30993be442 100644
--- a/flang/test/Semantics/synchronization02.f90
+++ b/flang/test/Semantics/synchronization02a.f90
@@ -1,15 +1,12 @@
 ! RUN: %python %S/test_errors.py %s %flang_fc1
-! XFAIL: *
-! Check for semantic errors in sync images statements
+! Check for errors in sync images statements
 
 program test_sync_images
   implicit none
 
-  integer, parameter :: invalid_rank(*,*) = reshape([1], [1,1])
-  integer sync_status, non_scalar(2), superfluous_stat, coindexed_integer[*], me
-  character(len=128) error_message, superfluous_errmsg, coindexed_character[*]
-  logical invalid_type
-  
+  integer sync_status, me
+  character(len=128) error_message
+
   !___ standard-conforming statement ___
 
   sync images(*, stat=sync_status, errmsg=error_message)
@@ -31,33 +28,15 @@ program test_sync_images
 
   !___ non-standard-conforming statement ___
 
-  !______ invalid image sets ______
-
-  ! Image set shall not depend on the value of stat-variable
-  !ERROR: TBD
-  sync images(sync_status, stat=sync_status)
-
-  ! Image set shall not depend on the value of errmsg-variable
-  !ERROR: TBD
-  sync images(len(error_message), errmsg=error_message)
+  !ERROR: expected '('
+  sync images
 
-  ! Image set shall be a scalar or rank-1 array
-  !ERROR: TBD
-  sync images(invalid_rank)
- 
   !______ invalid sync-stat-lists: invalid stat= ____________
 
   ! Invalid sync-stat-list keyword
   !ERROR: expected ')'
   sync images(1, status=sync_status)
 
-  !ERROR: TBD
-  sync images([1], stat=invalid_type)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync images(*, stat=non_scalar)
- 
   ! Invalid sync-stat-list: missing stat-variable
   !ERROR: expected ')'
   sync images(1, stat)
@@ -72,9 +51,6 @@ program test_sync_images
   !ERROR: expected ')'
   sync images(*, errormsg=error_message)
 
-  !ERROR: TBD
-  sync images(1, errmsg=invalid_type)
-
   ! Invalid sync-stat-list: missing 'errmsg='
   !ERROR: expected ')'
   sync images([1], error_message)
@@ -83,24 +59,4 @@ program test_sync_images
   !ERROR: expected ')'
   sync images(*, errmsg)
 
-  !______ invalid sync-stat-lists: redundant sync-stat-list ____________
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync images(1, stat=sync_status, stat=superfluous_stat)
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync images([1], errmsg=error_message, errmsg=superfluous_errmsg)
- 
-  !______ invalid sync-stat-lists: coindexed stat-variable ____________
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync images(*, stat=coindexed_integer[1])
- 
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync images(1, errmsg=coindexed_character[1])
-
 end program test_sync_images

diff  --git a/flang/test/Semantics/synchronization02b.f90 b/flang/test/Semantics/synchronization02b.f90
new file mode 100644
index 0000000000000..83558313a2dab
--- /dev/null
+++ b/flang/test/Semantics/synchronization02b.f90
@@ -0,0 +1,47 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Check for semantic errors in sync images statements.
+! Some of the errors in this test would be hidden by the errors in
+! the test synchronization02a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_sync_images
+  implicit none
+
+  integer, parameter :: invalid_rank(*,*) = reshape([1], [1,1])
+  integer sync_status, non_scalar(2), superfluous_stat, coindexed_integer[*]
+  character(len=128) error_message, superfluous_errmsg, coindexed_character[*]
+  logical invalid_type
+
+  !___ non-standard-conforming statements ___
+
+  ! Image set shall not depend on the value of stat-variable
+  sync images(sync_status, stat=sync_status)
+
+  ! Image set shall not depend on the value of errmsg-variable
+  sync images(len(error_message), errmsg=error_message)
+
+  ! Image set shall be a scalar or rank-1 array
+  sync images(invalid_rank)
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  sync images([1], stat=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  sync images(*, stat=non_scalar)
+
+  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
+  sync images(1, errmsg=invalid_type)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync images(1, stat=sync_status, stat=superfluous_stat)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync images([1], errmsg=error_message, errmsg=superfluous_errmsg)
+
+  ! Fortran 2018 standard C1173: `stat` shall not be coindexed
+  sync images(*, stat=coindexed_integer[1])
+
+  ! Fortran 2018 standard C1173: `errmsg` shall not be coindexed
+  sync images(1, errmsg=coindexed_character[1])
+
+end program test_sync_images

diff  --git a/flang/test/Semantics/synchronization03.f90 b/flang/test/Semantics/synchronization03.f90
deleted file mode 100644
index e6953826ee792..0000000000000
--- a/flang/test/Semantics/synchronization03.f90
+++ /dev/null
@@ -1,80 +0,0 @@
-! RUN: %python %S/test_errors.py %s %flang_fc1
-! XFAIL: *
-! This test checks for semantic errors in sync memory statements based on the
-! statement specification in section 11.6.5 of the Fortran 2018 standard.
-
-program test_sync_memory
-  implicit none
-
-  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
-  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
-  logical invalid_type
-  
-  !___ standard-conforming statement ___
-
-  sync memory
-  sync memory(stat=sync_status)
-  sync memory(                  errmsg=error_message)
-  sync memory(stat=sync_status, errmsg=error_message)
- 
-  !___ non-standard-conforming statement ___
-
-  !______ invalid sync-stat-lists: invalid stat= ____________
-
-  !ERROR: expected execution part construct
-  sync memory(status=sync_status)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync memory(stat=invalid_type)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync memory(stat=non_scalar)
-
-  ! Invalid sync-stat-list: missing stat-variable
-  !ERROR: expected execution part construct
-  sync memory(stat)
-
-  ! Invalid sync-stat-list: missing 'stat='
-  !ERROR: expected execution part construct
-  sync memory(sync_status)
-
-  !______ invalid sync-stat-lists: invalid errmsg= ____________
-
-  ! Invalid errmsg-variable keyword
-  !ERROR: expected execution part construct
-  sync memory(errormsg=error_message)
-
-  !ERROR: TBD
-  sync memory(errmsg=invalid_type)
-
-  ! Invalid sync-stat-list: missing 'errmsg='
-  !ERROR: expected execution part construct
-  sync memory(error_message)
-
-  ! Invalid sync-stat-list: missing errmsg-variable
-  !ERROR: expected execution part construct
-  sync memory(errmsg)
-
-  !______ invalid sync-stat-lists: redundant sync-stat-list ____________
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync memory(stat=sync_status, stat=superfluous_stat)
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync memory(errmsg=error_message, errmsg=superfluous_errmsg)
- 
-  !______ invalid sync-stat-lists: coindexed stat-variable ____________
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync memory(stat=co_indexed_integer[1])
- 
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync memory(errmsg=co_indexed_character[1])
-
-end program test_sync_memory

diff  --git a/flang/test/Semantics/synchronization03a.f90 b/flang/test/Semantics/synchronization03a.f90
new file mode 100644
index 0000000000000..11171e945a9f2
--- /dev/null
+++ b/flang/test/Semantics/synchronization03a.f90
@@ -0,0 +1,48 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for errors in sync memory statements based on the
+! statement specification in section 11.6.5 of the Fortran 2018 standard.
+
+program test_sync_memory
+  implicit none
+
+  integer sync_status
+  character(len=128) error_message
+
+  !___ standard-conforming statements ___
+
+  sync memory
+  sync memory()
+  sync memory(stat=sync_status)
+  sync memory(                  errmsg=error_message)
+  sync memory(stat=sync_status, errmsg=error_message)
+
+  !___ non-standard-conforming statements ___
+
+  !______ invalid sync-stat-lists: invalid stat= ____________
+
+  !ERROR: expected execution part construct
+  sync memory(status=sync_status)
+
+  ! Invalid sync-stat-list: missing stat-variable
+  !ERROR: expected execution part construct
+  sync memory(stat)
+
+  ! Invalid sync-stat-list: missing 'stat='
+  !ERROR: expected execution part construct
+  sync memory(sync_status)
+
+  !______ invalid sync-stat-lists: invalid errmsg= ____________
+
+  ! Invalid errmsg-variable keyword
+  !ERROR: expected execution part construct
+  sync memory(errormsg=error_message)
+
+  ! Invalid sync-stat-list: missing 'errmsg='
+  !ERROR: expected execution part construct
+  sync memory(error_message)
+
+  ! Invalid sync-stat-list: missing errmsg-variable
+  !ERROR: expected execution part construct
+  sync memory(errmsg)
+
+end program test_sync_memory

diff  --git a/flang/test/Semantics/synchronization03b.f90 b/flang/test/Semantics/synchronization03b.f90
new file mode 100644
index 0000000000000..c5077bba8311b
--- /dev/null
+++ b/flang/test/Semantics/synchronization03b.f90
@@ -0,0 +1,37 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for semantic errors in sync memory statements.
+! Some of the errors in this test would be hidden by the errors in
+! the test synchronization03a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_sync_memory
+  implicit none
+
+  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1)
+  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
+  logical invalid_type
+
+  !___ non-standard-conforming statements ___
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  sync memory(stat=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  sync memory(stat=non_scalar)
+
+  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
+  sync memory(errmsg=invalid_type)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync memory(stat=sync_status, stat=superfluous_stat)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync memory(errmsg=error_message, errmsg=superfluous_errmsg)
+
+  ! Fortran 2018 standard C1173: `stat` shall not be coindexed
+  sync memory(stat=co_indexed_integer[1])
+
+  ! Fortran 2018 standard C1173: `errmsg` shall not be coindexed
+  sync memory(errmsg=co_indexed_character[1])
+
+end program test_sync_memory

diff  --git a/flang/test/Semantics/synchronization04.f90 b/flang/test/Semantics/synchronization04.f90
deleted file mode 100644
index 9de8361f4a64c..0000000000000
--- a/flang/test/Semantics/synchronization04.f90
+++ /dev/null
@@ -1,91 +0,0 @@
-! RUN: %python %S/test_errors.py %s %flang_fc1
-! XFAIL: *
-! This test checks for semantic errors in sync team statements based on the
-! statement specification in section 11.6.6 of the Fortran 2018 standard.
-
-program test_sync_team
-  use iso_fortran_env, only : team_type
-  implicit none
-
-  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1), not_a_team
-  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
-  logical invalid_type
-  type(team_type) warriors
-   
-  
-  !___ standard-conforming statement ___
-
-  sync team(warriors)
-  sync team(warriors, stat=sync_status)
-  sync team(warriors,                   errmsg=error_message)
-  sync team(warriors, stat=sync_status, errmsg=error_message)
- 
-  !___ non-standard-conforming statement ___
-
-  !______ missing or invalid team-value _____________________
-
-  !ERROR: TBD
-  sync team(not_a_team)
-
-  !ERROR: expected ')'
-  sync team(stat=sync_status, errmsg=error_message)
-
-  !______ invalid sync-stat-lists: invalid stat= ____________
-
-  !ERROR: expected ')'
-  sync team(warriors, status=sync_status)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync team(warriors, stat=invalid_type)
-
-  ! Stat-variable must an integer scalar
-  !ERROR: TBD
-  sync team(warriors, stat=non_scalar)
-
-  ! Invalid sync-stat-list: missing stat-variable
-  !ERROR: expected ')'
-  sync team(warriors, stat)
-
-  ! Invalid sync-stat-list: missing 'stat='
-  !ERROR: expected ')'
-  sync team(warriors, sync_status)
-
-  !______ invalid sync-stat-lists: invalid errmsg= ____________
-
-  ! Invalid errmsg-variable keyword
-  !ERROR: expected ')'
-  sync team(warriors, errormsg=error_message)
-
-  !ERROR: TBD
-  sync team(warriors, errmsg=invalid_type)
-
-  ! Invalid sync-stat-list: missing 'errmsg='
-  !ERROR: expected ')'
-  sync team(warriors, error_message)
-
-  ! Invalid sync-stat-list: missing errmsg-variable
-  !ERROR: expected ')'
-  sync team(warriors, errmsg)
-
-  !______ invalid sync-stat-lists: redundant sync-stat-list ____________
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync team(warriors, stat=sync_status, stat=superfluous_stat)
-
-  ! No specifier shall appear more than once in a given sync-stat-list
-  !ERROR: to be determined
-  sync team(warriors, errmsg=error_message, errmsg=superfluous_errmsg)
- 
-  !______ invalid sync-stat-lists: coindexed stat-variable ____________
-
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync team(warriors, stat=co_indexed_integer[1])
- 
-  ! Check constraint C1173 from the Fortran 2018 standard
-  !ERROR: to be determined
-  sync team(warriors, errmsg=co_indexed_character[1])
-
-end program test_sync_team

diff  --git a/flang/test/Semantics/synchronization04a.f90 b/flang/test/Semantics/synchronization04a.f90
new file mode 100644
index 0000000000000..138cd34b225a2
--- /dev/null
+++ b/flang/test/Semantics/synchronization04a.f90
@@ -0,0 +1,57 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for errors in sync team statements based on the
+! statement specification in section 11.6.6 of the Fortran 2018 standard.
+
+program test_sync_team
+  use iso_fortran_env, only : team_type
+  implicit none
+
+  integer sync_status
+  character(len=128) error_message
+  type(team_type) warriors
+
+  !___ standard-conforming statement ___
+
+  sync team(warriors)
+  sync team(warriors, stat=sync_status)
+  sync team(warriors,                   errmsg=error_message)
+  sync team(warriors, stat=sync_status, errmsg=error_message)
+
+  !___ non-standard-conforming statement ___
+
+  !______ missing team-value _____________________
+
+  !ERROR: expected '('
+  sync team
+
+  !ERROR: expected ')'
+  sync team(stat=sync_status, errmsg=error_message)
+
+  !______ invalid sync-stat-lists: invalid stat= ____________
+
+  !ERROR: expected ')'
+  sync team(warriors, status=sync_status)
+
+  ! Invalid sync-stat-list: missing stat-variable
+  !ERROR: expected ')'
+  sync team(warriors, stat)
+
+  ! Invalid sync-stat-list: missing 'stat='
+  !ERROR: expected ')'
+  sync team(warriors, sync_status)
+
+  !______ invalid sync-stat-lists: invalid errmsg= ____________
+
+  ! Invalid errmsg-variable keyword
+  !ERROR: expected ')'
+  sync team(warriors, errormsg=error_message)
+
+  ! Invalid sync-stat-list: missing 'errmsg='
+  !ERROR: expected ')'
+  sync team(warriors, error_message)
+
+  ! Invalid sync-stat-list: missing errmsg-variable
+  !ERROR: expected ')'
+  sync team(warriors, errmsg)
+
+end program test_sync_team

diff  --git a/flang/test/Semantics/synchronization04b.f90 b/flang/test/Semantics/synchronization04b.f90
new file mode 100644
index 0000000000000..8818b529f32db
--- /dev/null
+++ b/flang/test/Semantics/synchronization04b.f90
@@ -0,0 +1,42 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! This test checks for semantic errors in sync team statements.
+! Some of the errors in this test would be hidden by the errors in
+! the test synchronization04a.f90 if they were included in that file,
+! and are thus tested here.
+
+program test_sync_team
+  use iso_fortran_env, only : team_type
+  implicit none
+
+  integer sync_status, co_indexed_integer[*], superfluous_stat, non_scalar(1), not_a_team
+  character(len=128) error_message, co_indexed_character[*], superfluous_errmsg
+  logical invalid_type
+  type(team_type) warriors
+
+  !___ non-standard-conforming statements ___
+
+  !ERROR: Team value must be of type TEAM_TYPE from module ISO_FORTRAN_ENV
+  sync team(not_a_team)
+
+  !ERROR: Must have INTEGER type, but is LOGICAL(4)
+  sync team(warriors, stat=invalid_type)
+
+  !ERROR: Must be a scalar value, but is a rank-1 array
+  sync team(warriors, stat=non_scalar)
+
+  !ERROR: Must have CHARACTER type, but is LOGICAL(4)
+  sync team(warriors, errmsg=invalid_type)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync team(warriors, stat=sync_status, stat=superfluous_stat)
+
+  ! No specifier shall appear more than once in a given sync-stat-list
+  sync team(warriors, errmsg=error_message, errmsg=superfluous_errmsg)
+
+  ! Fortran 2018 standard C1173: `stat` shall not be coindexed
+  sync team(warriors, stat=co_indexed_integer[1])
+
+  ! Fortran 2018 standard C1173: `errmsg` shall not be coindexed
+  sync team(warriors, errmsg=co_indexed_character[1])
+
+end program test_sync_team


        


More information about the flang-commits mailing list