From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1729) id 7B83E3851146; Wed, 29 Jun 2022 14:37:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B83E3851146 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Kwok Yeung To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] OpenACC: fix privatization of by-reference arrays X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: 49577050cb3e16a17e57c08c58bbe16f97bf94a5 X-Git-Newrev: 5190d7438a1a9cb93f49183de887b103bfd05c44 Message-Id: <20220629143728.7B83E3851146@sourceware.org> Date: Wed, 29 Jun 2022 14:37:28 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2022 14:37:28 -0000 https://gcc.gnu.org/g:5190d7438a1a9cb93f49183de887b103bfd05c44 commit 5190d7438a1a9cb93f49183de887b103bfd05c44 Author: Tobias Burnus 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 + + * gimplify.cc (localize_reductions): Do not create local + variable for privatized arrays. + 2020-03-27 Sandra Loosemore * 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;