public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1319] openmp: Gimplify OMP_CLAUSE_SIZE during gfc_omp_finish_clause [PR100965]
@ 2021-06-09  8:49 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-06-09  8:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d4d38135b3137f1d3148138340e67bdcd7ea8216

commit r12-1319-gd4d38135b3137f1d3148138340e67bdcd7ea8216
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 9 10:48:41 2021 +0200

    openmp: Gimplify OMP_CLAUSE_SIZE during gfc_omp_finish_clause [PR100965]
    
    As the testcase shows, we need to gimplify OMP_CLAUSE_SIZE, so that we
    don't end up with SAVE_EXPR or anything similar non-gimple in it.
    
    2021-06-08  Jakub Jelinek  <jakub@redhat.com>
    
            PR fortran/100965
            * trans-openmp.c (gfc_omp_finish_clause): Gimplify OMP_CLAUSE_SIZE.
    
            * gfortran.dg/gomp/pr100965.f90: New test.

Diff:
---
 gcc/fortran/trans-openmp.c                  |  3 +++
 gcc/testsuite/gfortran.dg/gomp/pr100965.f90 | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index c8c61a54582..f466ab675c3 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1639,6 +1639,9 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p, bool openacc)
     OMP_CLAUSE_SIZE (c)
       = DECL_P (decl) ? DECL_SIZE_UNIT (decl)
 		      : TYPE_SIZE_UNIT (TREE_TYPE (decl));
+  if (gimplify_expr (&OMP_CLAUSE_SIZE (c), pre_p,
+		     NULL, is_gimple_val, fb_rvalue) == GS_ERROR)
+    OMP_CLAUSE_SIZE (c) = size_int (0);
   if (c2)
     {
       OMP_CLAUSE_CHAIN (c2) = OMP_CLAUSE_CHAIN (last);
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr100965.f90 b/gcc/testsuite/gfortran.dg/gomp/pr100965.f90
new file mode 100644
index 00000000000..9044547df6e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr100965.f90
@@ -0,0 +1,16 @@
+! PR fortran/100965
+! { dg-do compile }
+
+implicit none
+  character(len=:), allocatable :: s
+  logical :: l
+  !$omp target map(from: l)
+    l = allocated (s)
+  !$omp end target
+  if (l) stop 1
+
+  !$omp target map(from: l)
+    l = allocated (s)
+  !$omp end target
+  if (l) stop 2
+end


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

only message in thread, other threads:[~2021-06-09  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  8:49 [gcc r12-1319] openmp: Gimplify OMP_CLAUSE_SIZE during gfc_omp_finish_clause [PR100965] Jakub Jelinek

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).