https://gcc.gnu.org/g:8d7562192cc814c6d0d48b424d7751762871a37b

commit 8d7562192cc814c6d0d48b424d7751762871a37b
Author: Tobias Burnus <tob...@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 331a88af92d..d4abd1c117c 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-06-03  Tobias Burnus  <tob...@codesourcery.com>
+
+       * gimplify.cc (localize_reductions): Do not create local
+       variable for privatized arrays.
+
 2020-02-06  Tobias Burnus  <tob...@codesourcery.com>
 
        * omp-low.c (convert_from_firstprivate_int):
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 1741f740f51..3a69d7b99b0 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -15195,8 +15195,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 via email to