aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-06-03 15:35:12 +0200
committerKwok Cheung Yeung <kcy@codesourcery.com>2022-06-21 14:11:24 +0100
commit5190d7438a1a9cb93f49183de887b103bfd05c44 (patch)
tree2b87d187f65647bcc40bae5c07d7922fa00dc06f /gcc
parent49577050cb3e16a17e57c08c58bbe16f97bf94a5 (diff)
downloadgcc-5190d7438a1a9cb93f49183de887b103bfd05c44.zip
gcc-5190d7438a1a9cb93f49183de887b103bfd05c44.tar.gz
gcc-5190d7438a1a9cb93f49183de887b103bfd05c44.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.omp5
-rw-r--r--gcc/gimplify.cc3
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 8558b83..750f7a2 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 7fcf4e4..9248ca5 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;