diff mbox series

[06/11] OpenMP: Allow array ref components for C & C++

Message ID dc3a99128a9fbd2911d589ee517bf3388f06bffd.1633106213.git.julian@codesourcery.com
State New
Headers show
Series OpenMP: Deep struct dereferences | expand

Commit Message

Julian Brown Oct. 1, 2021, 5:09 p.m. UTC
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  <julian@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 mbox series

Patch

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);