From: Kwok Cheung Yeung Date: Thu, 14 Apr 2022 20:21:11 +0000 (+0100) Subject: Fix ICE in OpenACC kernel testcases X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ad06e951e9ae93ad039325e58a569e56b3c610d;p=thirdparty%2Fgcc.git Fix ICE in OpenACC kernel testcases This is due to sequences like this occurring: : .data_dep.8_27 = .UNIQUE (OACC_TAIL_MARK, .data_dep.8_16, 2); : .data_dep.8_29 = .UNIQUE (OACC_JOIN, .data_dep.8_27, -1); ... : .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 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. --- diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index eba48717ee8d..1a9d3c507b55 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,9 @@ +2022-04-14 Kwok Cheung Yeung + + * 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 Backport from mainline: diff --git a/gcc/graphite-oacc.cc b/gcc/graphite-oacc.cc index 6ba5d0f293a1..3ca13597a5f1 100644 --- a/gcc/graphite-oacc.cc +++ b/gcc/graphite-oacc.cc @@ -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);