https://gcc.gnu.org/g:628a000bdbf63252c2ede13ccab8e99a19769866
commit 628a000bdbf63252c2ede13ccab8e99a19769866 Author: Kwok Cheung Yeung <k...@codesourcery.com> Date: Thu Mar 17 16:00:52 2022 +0000 Fix ICE when cache-3-1.c testcase is run A change that was present in the OG11 version of 'openmp: in_reduction clause support on target construct' but not in the mainline version resulted in non-contiguous arrays being accepted in cache clauses, only to ICE later. 2022-03-17 Kwok Cheung Yeung <k...@codesourcery.com> gcc/c/ * c-typeck.cc (handle_omp_array_sections_1): Add check to ensure that clause is a map. gcc/cp/ * semantics.cc (handle_omp_array_sections_1): Add check to ensure that clause is a map. Diff: --- gcc/c/ChangeLog.omp | 5 +++++ gcc/c/c-typeck.cc | 3 ++- gcc/cp/ChangeLog.omp | 5 +++++ gcc/cp/semantics.cc | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/c/ChangeLog.omp b/gcc/c/ChangeLog.omp index 4b8331c3744..db1ddfb1720 100644 --- a/gcc/c/ChangeLog.omp +++ b/gcc/c/ChangeLog.omp @@ -1,3 +1,8 @@ +2022-03-17 Kwok Cheung Yeung <k...@codesourcery.com> + + * c-typeck.cc (handle_omp_array_sections_1): Add check to ensure + that clause is a map. + 2021-08-19 Chung-Lin Tang <clt...@codesourcery.com> * c-typeck.cc (handle_omp_array_sections_1): Robustify non-contiguous diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 3fea8185c0a..b5a023a1299 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -14185,7 +14185,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types, tree d_length = TREE_OPERAND (d, 2); if (d_length == NULL_TREE || !integer_onep (d_length)) { - if (ort == C_ORT_ACC) + if (ort == C_ORT_ACC + && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP) { while (TREE_CODE (d) == TREE_LIST) d = TREE_CHAIN (d); diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp index 71b0f57918f..c78a2d37e18 100644 --- a/gcc/cp/ChangeLog.omp +++ b/gcc/cp/ChangeLog.omp @@ -1,3 +1,8 @@ +2022-03-17 Kwok Cheung Yeung <k...@codesourcery.com> + + * semantics.cc (handle_omp_array_sections_1): Add check to ensure + that clause is a map. + 2021-08-19 Chung-Lin Tang <clt...@codesourcery.com> * semantics.cc (handle_omp_array_sections_1): Robustify non-contiguous diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 9b8d5ac2ce8..0e88b380696 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -5837,7 +5837,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types, tree d_length = TREE_OPERAND (d, 2); if (d_length == NULL_TREE || !integer_onep (d_length)) { - if (ort == C_ORT_ACC) + if (ort == C_ORT_ACC + && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP) { while (TREE_CODE (d) == TREE_LIST) d = TREE_CHAIN (d);