]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenACC: fix privatization of by-reference arrays
authorTobias Burnus <tobias@codesourcery.com>
Wed, 3 Jun 2020 13:35:12 +0000 (15:35 +0200)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 21 Jun 2022 13:11:24 +0000 (14:11 +0100)
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.

gcc/ChangeLog.omp
gcc/gimplify.cc

index 8558b83a15114190072dd8dde8f72e744fba82da..750f7a2aad298ac7455176777b382f2ca7e0992b 100644 (file)
@@ -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
index 7fcf4e48da40a2d7d53b2e8d596350cb4a9d9b1c..9248ca56b162a1c638e44f7854abcbb24eb21749 100644 (file)
@@ -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;