public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] Fix ICE when cache-3-1.c testcase is run
@ 2022-06-29 14:48 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2022-06-29 14:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:00e6d2d70c212728f9bd3c1517bbef93376eee4a

commit 00e6d2d70c212728f9bd3c1517bbef93376eee4a
Author: Kwok Cheung Yeung <kcy@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  <kcy@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 21908779596..0724d190a61 100644
--- a/gcc/c/ChangeLog.omp
+++ b/gcc/c/ChangeLog.omp
@@ -1,3 +1,8 @@
+2022-03-17  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* c-typeck.cc (handle_omp_array_sections_1): Add check to ensure
+	that clause is a map.
+
 2022-05-12  Jakub Jelinek  <jakub@redhat.com>
 
 	Backport from mainline:
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index bfbaf0feadc..6c42716f105 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -13575,7 +13575,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
 	      tree d_length = TREE_VALUE (d);
 	      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 01ffe06efcf..275bed34cf2 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2022-03-17  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* semantics.cc (handle_omp_array_sections_1):  Add check to ensure
+	that clause is a map.
+
 2022-05-12  Jakub Jelinek  <jakub@redhat.com>
 
 	Backport from mainline:
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index c2f9d3bd416..8a79def9be7 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -5409,7 +5409,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
 	      tree d_length = TREE_VALUE (d);
 	      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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-29 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 14:48 [gcc/devel/omp/gcc-12] Fix ICE when cache-3-1.c testcase is run Kwok Yeung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).