Fix ICE for cases like:
#pragma omp target update from(s[0].a[0:1])
where multiple ARRAY_REF nodes exist and require more than one peeling
during [c_]finish_omp_clauses.
PR c++/103705
gcc/c/ChangeLog:
* c-typeck.c (c_finish_omp_clauses): Also continue peeling off of
outer node for ARRAY_REFs.
gcc/cp/ChangeLog:
* semantics.c (finish_omp_clauses): Also continue peeling off of
outer node for ARRAY_REFs.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/pr103705.c: New test.
t = TREE_OPERAND (t, 0);
}
}
- while (TREE_CODE (t) == COMPONENT_REF);
+ while (TREE_CODE (t) == COMPONENT_REF
+ || TREE_CODE (t) == ARRAY_REF);
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& OMP_CLAUSE_MAP_IMPLICIT (c)
t = TREE_OPERAND (t, 0);
}
}
- while (TREE_CODE (t) == COMPONENT_REF);
+ while (TREE_CODE (t) == COMPONENT_REF
+ || TREE_CODE (t) == ARRAY_REF);
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& OMP_CLAUSE_MAP_IMPLICIT (c)
--- /dev/null
+/* PR c++/103705 */
+/* { dg-do compile } */
+
+struct S
+{
+ int a[2];
+};
+
+int main (void)
+{
+ struct S s[1];
+ #pragma omp target update from(s[0].a[0:1])
+ return 0;
+}