]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE in OpenACC kernel testcases
authorKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 14 Apr 2022 20:21:11 +0000 (21:21 +0100)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 28 Jun 2022 20:55:30 +0000 (13:55 -0700)
This is due to sequences like this occurring:

<bb 11> :
  .data_dep.8_27 = .UNIQUE (OACC_TAIL_MARK, .data_dep.8_16, 2);

<bb 12> :
  .data_dep.8_29 = .UNIQUE (OACC_JOIN, .data_dep.8_27, -1);
...
<bb 15> :
  .UNIQUE (OACC_TAIL_MARK, .data_dep.8_33);

The final tail mark has no LHS, causing code that assumes its presence to
segfault.  The LHS and the assignment appear to have been removed as dead
code by the cddce1 stage.

Fixed by checking for the presence of the LHS before using it.

2022-04-14  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/
* graphite-oacc.cc (find_oacc_tail_marks): Check that data_dep is
non-NULL before testing it.
(reduction_use_in_outer_loop_p): Likewise.

gcc/ChangeLog.omp
gcc/graphite-oacc.cc

index eba48717ee8d987adbf766c1b870a2000db41ec7..1a9d3c507b55739fc81c3cd451660589cebbe926 100644 (file)
@@ -1,3 +1,9 @@
+2022-04-14  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+       * graphite-oacc.cc (find_oacc_tail_marks): Check that data_dep is
+       non-NULL before testing it.
+       (reduction_use_in_outer_loop_p): Likewise.
+
 2022-05-12  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline:
index 6ba5d0f293a1c2628998d52562502468073e7b4f..3ca13597a5f142ba08d662d3b139c59175c42022 100644 (file)
@@ -253,7 +253,7 @@ find_oacc_tail_marks (loop_p loop)
   tree data_dep = gimple_call_lhs (top_tail_mark);
   gimple *stmt = top_tail_mark;
 
-  while (has_single_use (data_dep))
+  while (data_dep && has_single_use (data_dep))
     {
       use_operand_p use_p;
       single_imm_use (data_dep, &use_p, &stmt);
@@ -313,7 +313,7 @@ reduction_use_in_outer_loop_p (gcall *call)
   /* The IFN_GOACC_REDUCTION_CALLS are linked in a chain through
      immediate uses. Move to the end of this chain. */
   gimple *stmt = call;
-  while (has_single_use (data_dep))
+  while (data_dep && has_single_use (data_dep))
     {
       use_operand_p use_p;
       single_imm_use (data_dep, &use_p, &stmt);