]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE when cache-3-1.c testcase is run
authorKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 17 Mar 2022 16:00:52 +0000 (16:00 +0000)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 28 Jun 2022 20:55:30 +0000 (13:55 -0700)
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.

gcc/c/ChangeLog.omp
gcc/c/c-typeck.cc
gcc/cp/ChangeLog.omp
gcc/cp/semantics.cc

index 219087795965e8535ccb267cb81d8b5b95dec880..0724d190a61dfb727fcb7e664797aea5efe6ab83 100644 (file)
@@ -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:
index bfbaf0feadc2abb187f037f8c5d011ebbabdcd58..6c42716f1051a36b87ca071d9deb2c1ad23c2717 100644 (file)
@@ -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);
index 01ffe06efcf0c05b361d8fcfcc6c46bb80df1fcf..275bed34cf2e7c462d747195ff40b11e216501e7 100644 (file)
@@ -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:
index c2f9d3bd4162f6cfca80ec5253b954165380d41e..8a79def9be7ead1edce2814b6adfa8603a8f9bf9 100644 (file)
@@ -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);