[gcc/devel/omp/gcc-14] Fix non-contiguous array support

Paul-Antoine Arras parras@gcc.gnu.org
Fri Jun 28 09:57:17 GMT 2024


https://gcc.gnu.org/g:8c1068bbe3e52529bede5466a43af8d98f38dac2

commit 8c1068bbe3e52529bede5466a43af8d98f38dac2
Author: Paul-Antoine Arras <parras@baylibre.com>
Date:   Wed May 29 15:57:22 2024 +0200

    Fix non-contiguous array support
    
    Make commit 9dfd943acf3de00142f86cea5283345725e74cef
    'Update expected messages in data-clause-1 tests'
    valid again.

Diff:
---
 gcc/c/c-typeck.cc   | 7 +++----
 gcc/cp/semantics.cc | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index a1a2f10c05c..c728e69a748 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -14276,11 +14276,10 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
 	      if (d_length == NULL_TREE || !integer_onep (d_length)
 		  || (d_stride && !integer_onep (d_stride)))
 		{
-		  if (ort == C_ORT_ACC
-		      && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
+		  if (openacc && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
 		    {
-		      while (TREE_CODE (d) == TREE_LIST)
-			d = TREE_CHAIN (d);
+		      while (TREE_CODE (d) == OMP_ARRAY_SECTION)
+			d = TREE_OPERAND (d, 0);
 		      if (DECL_P (d))
 			{
 			  /* Note that OpenACC does accept these kinds of
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index ac93ac5e912..f244008f7df 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -5884,11 +5884,10 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
 		  || !integer_onep (d_length)
 		  || (d_stride && !integer_onep (d_stride)))
 		{
-		  if (ort == C_ORT_ACC
-		      && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
+		  if (openacc && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
 		    {
-		      while (TREE_CODE (d) == TREE_LIST)
-			d = TREE_CHAIN (d);
+		      while (TREE_CODE (d) == OMP_ARRAY_SECTION)
+			d = TREE_OPERAND (d, 0);
 		      if (DECL_P (d))
 			{
 			  /* Note that OpenACC does accept these kinds of


More information about the Gcc-cvs mailing list