aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/trans-openmp.c3
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr100965.f9016
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index c8c61a5..f466ab6 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 0000000..9044547
--- /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