public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] Fix ICE in kernels-decompose-pr100280-1.c testcase
Date: Wed, 29 Jun 2022 14:48:38 +0000 (GMT)	[thread overview]
Message-ID: <20220629144838.3B02F385022A@sourceware.org> (raw)

https://gcc.gnu.org/g:2f7ab1a1fdedb4529c964f462cb6b108caf137ae

commit 2f7ab1a1fdedb4529c964f462cb6b108caf137ae
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Tue May 10 15:46:37 2022 +0100

    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  <kcy@codesourcery.com>
    
            gcc/c-family/
            * c-omp.cc (check_and_annotate_for_loop): Check that the DECL_INITIAL
            is non-NULL before using.

Diff:
---
 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 84e73af6824..e46a556ada5 100644
--- a/gcc/c-family/ChangeLog.omp
+++ b/gcc/c-family/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-04-15  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	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  <jakub@redhat.com>
 
 	Backport from mainline:
diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc
index ddcd52f06e7..a6fea51d46e 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


                 reply	other threads:[~2022-06-29 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220629144838.3B02F385022A@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).