From 2f7ab1a1fdedb4529c964f462cb6b108caf137ae Mon Sep 17 00:00:00 2001 From: Kwok Cheung Yeung Date: Tue, 10 May 2022 15:46:37 +0100 Subject: [PATCH] Fix ICE in kernels-decompose-pr100280-1.c testcase Check that there is a DECL_INITIAL associated with prev_stmt before using it. 2022-04-15 Kwok Cheung Yeung gcc/c-family/ * c-omp.cc (check_and_annotate_for_loop): Check that the DECL_INITIAL is non-NULL before using. --- gcc/c-family/ChangeLog.omp | 6 ++++++ gcc/c-family/c-omp.cc | 1 + 2 files changed, 7 insertions(+) diff --git a/gcc/c-family/ChangeLog.omp b/gcc/c-family/ChangeLog.omp index 84e73af68246..e46a556ada5c 100644 --- a/gcc/c-family/ChangeLog.omp +++ b/gcc/c-family/ChangeLog.omp @@ -1,3 +1,9 @@ +2022-04-15 Kwok Cheung Yeung + + gcc/c-family/ + * c-omp.cc (check_and_annotate_for_loop): Check that the DECL_INITIAL + is non-NULL before using. + 2022-05-12 Jakub Jelinek Backport from mainline: diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc index ddcd52f06e7d..a6fea51d46e0 100644 --- a/gcc/c-family/c-omp.cc +++ b/gcc/c-family/c-omp.cc @@ -3400,6 +3400,7 @@ check_and_annotate_for_loop (tree *nodeptr, tree_stmt_iterator *prev_tsi, unlink_prev = true; } else if (is_local_var (prev_stmt) + && DECL_INITIAL (prev_stmt) && !TREE_SIDE_EFFECTS (DECL_INITIAL (prev_stmt))) { /* If the preceding statement is the declaration of the loop -- 2.47.2