public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] OpenACC: fix privatization of by-reference arrays
@ 2022-06-29 14:37 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2022-06-29 14:37 UTC (permalink / raw)
  To: gcc-cvs

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;


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

only message in thread, other threads:[~2022-06-29 14:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 14:37 [gcc/devel/omp/gcc-12] OpenACC: fix privatization of by-reference arrays 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).