]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/92899 ([OpenMP] ICE in gfc_trans_omp_atomic, at fortran/trans...
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Dec 2019 17:42:22 +0000 (18:42 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Dec 2019 17:42:22 +0000 (18:42 +0100)
Backported from mainline
2019-12-11  Jakub Jelinek  <jakub@redhat.com>

PR fortran/92899
* trans-openmp.c (gfc_trans_omp_atomic): For GFC_OMP_ATOMIC_SWAP,
do look through conversion on expr2 if any.

* testsuite/libgomp.fortran/atomic1.f90: New test.

From-SVN: r279672

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
gcc/testsuite/ChangeLog
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/atomic1.f90 [new file with mode: 0644]

index 97c9fab7a9400af75b49d55f26241a94d4682162..37526d21e87ff3e9c5de5fa3cb1e6a90332606f2 100644 (file)
@@ -1,6 +1,12 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/92899
+       * trans-openmp.c (gfc_trans_omp_atomic): For GFC_OMP_ATOMIC_SWAP,
+       do look through conversion on expr2 if any.
+
        2019-12-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/92775
index 0eb5956cc5313b97a17ebdbddec3d85b0a2148d9..98e3d58e174d994539a7ce30455984f36913e288 100644 (file)
@@ -3215,7 +3215,6 @@ gfc_trans_omp_atomic (gfc_code *code)
   expr2 = code->expr2;
   if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
        != GFC_OMP_ATOMIC_WRITE)
-      && (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SWAP) == 0
       && expr2->expr_type == EXPR_FUNCTION
       && expr2->value.function.isym
       && expr2->value.function.isym->id == GFC_ISYM_CONVERSION)
index 3127761d8acc8bc492dbbec612a3a8f573b044c0..0cec4e7ab6b6d07cae6b72ce92a977a87c260514 100644 (file)
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/92723
+       * gcc.dg/vect/pr92723.c: New test.
+
        2019-12-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/92831 - CWG 1299, not extending temporary lifetime for ?:
index ec959f302ca3bac69c4a28649ef97e97811a99c4..da2b99fa933bfc6904e728f16e3e6d8b97cfa550 100644 (file)
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/92899
+       * testsuite/libgomp.fortran/atomic1.f90: New test.
+
        2019-11-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/60228
diff --git a/libgomp/testsuite/libgomp.fortran/atomic1.f90 b/libgomp/testsuite/libgomp.fortran/atomic1.f90
new file mode 100644 (file)
index 0000000..e0c1353
--- /dev/null
@@ -0,0 +1,46 @@
+! PR fortran/92899
+
+program pr92899
+  real :: x = 1.0
+  double precision :: y
+  integer(kind=4) :: z = 4
+  integer(kind=8) :: w
+  !$omp atomic capture
+  y = x
+  x = 2.0
+  !$omp end atomic
+  if (y /= 1.0 .or. x /= 2.0) stop 1
+  !$omp atomic capture
+  x = y
+  y = 3.0
+  !$omp end atomic
+  if (x /= 1.0 .or. y /= 3.0) stop 2
+  !$omp atomic capture
+  w = z
+  z = 5
+  !$omp end atomic
+  if (w /= 4 .or. z /= 5) stop 3
+  !$omp atomic capture
+  z = w
+  w = 6
+  !$omp end atomic
+  if (z /= 4 .or. w /= 6) stop 4
+  !$omp atomic write
+  x = y
+  !$omp end atomic
+  if (x /= 3.0 .or. y /= 3.0) stop 5
+  x = 7.0
+  !$omp atomic write
+  y = x
+  !$omp end atomic
+  if (x /= 7.0 .or. y /= 7.0) stop 6
+  !$omp atomic write
+  z = w
+  !$omp end atomic
+  if (z /= 6 .or. w /= 6) stop 7
+  z = 8
+  !$omp atomic write
+  w = z
+  !$omp end atomic
+  if (z /= 8 .or. w /= 8) stop 8
+end