public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] OpenACC: fix privatization of by-reference arrays
Date: Wed, 29 Jun 2022 14:37:28 +0000 (GMT)	[thread overview]
Message-ID: <20220629143728.7B83E3851146@sourceware.org> (raw)

https://gcc.gnu.org/g:5190d7438a1a9cb93f49183de887b103bfd05c44

commit 5190d7438a1a9cb93f49183de887b103bfd05c44
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Jun 3 15:35:12 2020 +0200

    OpenACC: fix privatization of by-reference arrays
    
    Replacing of a by-reference variable in a private clause by a local variable
    makes sense; however, for arrays, the size is not directly known by the type.
    This causes an ICE via create_tmp_var which indirectly invokes
    force_constant_size in this case - but the latter only handled Ada.
    
    gcc/ChangeLog:
    
            * gimplify.cc (localize_reductions): Do not create local
            variable for privatized arrays.

Diff:
---
 gcc/ChangeLog.omp | 5 +++++
 gcc/gimplify.cc   | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 8558b83a151..750f7a2aad2 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-06-03  Tobias Burnus  <tobias@codesourcery.com>
+
+	* gimplify.cc (localize_reductions): Do not create local
+	variable for privatized arrays.
+
 2020-03-27  Sandra Loosemore  <sandra@codesourcery.com>
 
 	* doc/invoke.texi (Option Summary): Add entries for
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 7fcf4e48da4..9248ca56b16 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -12622,8 +12622,9 @@ localize_reductions (tree clauses, tree body)
 
 	if (!lang_hooks.decls.omp_privatize_by_reference (var))
 	  continue;
-
 	type = TREE_TYPE (TREE_TYPE (var));
+	if (TREE_CODE (type) == ARRAY_TYPE)
+	  continue;
 	new_var = create_tmp_var (type, IDENTIFIER_POINTER (DECL_NAME (var)));
 
 	pr.ref_var = var;


                 reply	other threads:[~2022-06-29 14:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220629143728.7B83E3851146@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).