public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] omp-low.c: Avoid offload-target lto1 is-missing error by not-privatizing TREE_READONLY vars
@ 2021-05-13 16:16 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2021-05-13 16:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7b2e24f0481bc8269a8e6e356e560d011b52909e

commit 7b2e24f0481bc8269a8e6e356e560d011b52909e
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Jul 27 08:31:51 2020 +0200

    omp-low.c: Avoid offload-target lto1 is-missing error by not-privatizing TREE_READONLY vars
    
    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.

Diff:
---
 gcc/omp-low.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 9b1d5e3763d..3c7f8f986de 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10128,7 +10128,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);
       }
 }
@@ -10143,7 +10145,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);
 }


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

only message in thread, other threads:[~2021-05-13 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 16:16 [gcc/devel/omp/gcc-11] omp-low.c: Avoid offload-target lto1 is-missing error by not-privatizing TREE_READONLY vars Kwok Yeung

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