]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
omp-low.c: Avoid offload-target lto1 is-missing error by not-privatizing TREE_READONL...
authorTobias Burnus <tobias@codesourcery.com>
Mon, 27 Jul 2020 06:31:51 +0000 (08:31 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 27 Jul 2020 06:31:51 +0000 (08:31 +0200)
Fixes issue exposed by testsuite/libgomp.oacc-fortran/privatized-ref-2.f90

gcc/ChangeLog:

* omp-low.c (oacc_record_private_var_clauses,
oacc_record_vars_in_bind): Do not privatize read-only static/extern
variables.

gcc/omp-low.c

index 096036353506e9dc58ee748e8e1b6c4167fa8c04..bd3866c4d2ed339305b5fb9ca9c6223d22f5382f 100644 (file)
@@ -9813,7 +9813,9 @@ oacc_record_private_var_clauses (omp_context *ctx, tree clauses)
     if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_PRIVATE)
       {
        tree decl = OMP_CLAUSE_DECL (c);
-       if (VAR_P (decl) && TREE_ADDRESSABLE (decl))
+       if (VAR_P (decl) && TREE_ADDRESSABLE (decl)
+           && !(TREE_READONLY (decl)
+                && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))))
          ctx->oacc_addressable_var_decls->safe_push (decl);
       }
 }
@@ -9828,7 +9830,8 @@ oacc_record_vars_in_bind (omp_context *ctx, tree bindvars)
     return;
 
   for (tree v = bindvars; v; v = DECL_CHAIN (v))
-    if (VAR_P (v) && TREE_ADDRESSABLE (v))
+    if (VAR_P (v) && TREE_ADDRESSABLE (v)
+       && !(TREE_READONLY (v) && (TREE_STATIC (v) || DECL_EXTERNAL (v))))
       ctx->oacc_addressable_var_decls->safe_push (v);
 }