public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] testsuite: Fix up gfortran.dg/gomp/strictly*.f90 testcases
@ 2021-10-21 13:55 Chung-Lin Tang
  0 siblings, 0 replies; only message in thread
From: Chung-Lin Tang @ 2021-10-21 13:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:45112654bfb5b6540a5d1686c011cc1f25062aff

commit 45112654bfb5b6540a5d1686c011cc1f25062aff
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Oct 21 11:12:55 2021 +0200

    testsuite: Fix up gfortran.dg/gomp/strictly*.f90 testcases
    
    While these testcases are dg-do compile only, I think it is better not to
    give users bad examples and avoid unnecessary data races in testcases (unless
    it is exactly what we want to test).  Perhaps one day we'll do some analysis
    and warn about data races...
    
    2021-10-21  Jakub Jelinek  <jakub@redhat.com>
    
            * gfortran.dg/gomp/strictly-structured-block-1.f90: Use call do_work
            instead of x = x + 1 in places where the latter could be a data race.
            * gfortran.dg/gomp/strictly-structured-block-2.f90: Likewise.
            * gfortran.dg/gomp/strictly-structured-block-3.f90: Likewise.
    
    (cherry picked from commit e633f82fb71817f3232688869c1eb59f60eb78ca)

Diff:
---
 .../gomp/strictly-structured-block-1.f90           | 28 +++++++++++-----------
 .../gomp/strictly-structured-block-2.f90           | 28 +++++++++++-----------
 .../gomp/strictly-structured-block-3.f90           |  4 ++--
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-1.f90 b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-1.f90
index 00a018c6145..ef8507eb7f0 100644
--- a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-1.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-1.f90
@@ -9,23 +9,23 @@ program main
 
   !$omp parallel
   block
-    x = x + 1
+    call do_work
   end block
 
   !$omp parallel
   block
-    x = x + 1
+    call do_work
   end block
   !$omp end parallel
 
   !$omp teams
   block
-    x = x + 1
+    call do_work
   end block
 
   !$omp teams
   block
-    x = x + 1
+    call do_work
   end block
   !$omp end teams
 
@@ -42,12 +42,12 @@ program main
 
   !$omp scope
   block
-    x = x + 1
+    call do_work
   end block
 
   !$omp scope
   block
-    x = x + 1
+    call do_work
   end block
   !$omp end scope
 
@@ -75,12 +75,12 @@ program main
 
   !$omp task
   block
-    x = x + 1
+    call do_work
   end block
 
   !$omp task
   block
-    x = x + 1
+    call do_work
   end block
   !$omp end task
 
@@ -130,23 +130,23 @@ program main
 
   !$omp target parallel
   block
-    x = x + 1
+    call do_work
   end block
 
   !$omp target parallel
   block
-    x = x + 1
+    call do_work
   end block
   !$omp end target parallel
 
   !$omp target teams
   block
-    x = x + 1
+    call do_work
   end block
 
   !$omp target teams
   block
-    x = x + 1
+    call do_work
   end block
   !$omp end target teams
 
@@ -176,7 +176,7 @@ program main
   do i = 1, n
      !$omp ordered
      block
-       x = x + 1
+       call do_work
      end block
   end do
 
@@ -184,7 +184,7 @@ program main
   do i = 1, n
      !$omp ordered
      block
-       x = x + 1
+       call do_work
      end block
      !$omp end ordered
   end do
diff --git a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-2.f90 b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-2.f90
index a99616980c0..ad4d08a1d49 100644
--- a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-2.f90
@@ -9,16 +9,16 @@ program main
 
   !$omp parallel
   block
-    x = x + 1
+    call do_work
   end block
-  x = x + 1
+  call do_work
   !$omp end parallel ! { dg-error "Unexpected !.OMP END PARALLEL statement" }
 
   !$omp teams
   block
-    x = x + 1
+    call do_work
   end block
-  x = x + 1
+  call do_work
   !$omp end teams ! { dg-error "Unexpected !.OMP END TEAMS statement" }
 
   !$omp masked
@@ -30,9 +30,9 @@ program main
 
   !$omp scope
   block
-    x = x + 1
+    call do_work
   end block
-  x = x + 1
+  call do_work
   !$omp end scope ! { dg-error "Unexpected !.OMP END SCOPE statement" }
 
   !$omp single
@@ -51,9 +51,9 @@ program main
 
   !$omp task
   block
-    x = x + 1
+    call do_work
   end block
-  x = x + 1
+  call do_work
   !$omp end task ! { dg-error "Unexpected !.OMP END TASK statement" }
 
   !$omp target data map(x)
@@ -86,16 +86,16 @@ program main
 
   !$omp target parallel
   block
-    x = x + 1
+    call do_work
   end block
-  x = x + 1
+  call do_work
   !$omp end target parallel ! { dg-error "Unexpected !.OMP END TARGET PARALLEL statement" }
 
   !$omp target teams
   block
-    x = x + 1
+    call do_work
   end block
-  x = x + 1
+  call do_work
   !$omp end target teams ! { dg-error "Unexpected !.OMP END TARGET TEAMS statement" }
 
   !$omp critical
@@ -116,9 +116,9 @@ program main
   do i = 1, n
      !$omp ordered
      block
-       x = x + 1
+       call do_work
      end block
-     x = x + 1
+     call do_work
      !$omp end ordered ! { dg-error "Unexpected !.OMP END ORDERED statement" }
   end do
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-3.f90 b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-3.f90
index f9c76d64120..ae85fa08643 100644
--- a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-3.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-3.f90
@@ -10,7 +10,7 @@ program main
   !$omp parallel
     !$omp parallel
     block
-      x = x + 1
+      call do_work
     end block
     !$omp end parallel
   !$omp end parallel
@@ -32,7 +32,7 @@ program main
     end block
     x = x + 2
     !$omp section
-    x = x + 4
+    call do_work
   end block
 
   !$omp sections


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-21 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 13:55 [gcc/devel/omp/gcc-11] testsuite: Fix up gfortran.dg/gomp/strictly*.f90 testcases Chung-Lin Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).