This patch fixes parsing for struct components that are array references in OMP clauses in both the C and C++ front ends.
OK for mainline? Thanks, Julian 2021-09-29 Julian Brown <jul...@codesourcery.com> gcc/c/ * c-typeck.c (c_finish_omp_clauses): Allow ARRAY_REF components. gcc/cp/ * semantics.c (finish_omp_clauses): Allow ARRAY_REF components. --- gcc/c/c-typeck.c | 3 ++- gcc/cp/semantics.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index e10e6aa8439..d0494cadf05 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -14815,7 +14815,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF) + || TREE_CODE (t) == INDIRECT_REF + || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6e954ca06a6..53bd8d236bb 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7849,7 +7849,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (REFERENCE_REF_P (t)) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF) + || TREE_CODE (t) == INDIRECT_REF + || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); -- 2.29.2