public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: matz@suse.de, Richard Biener <rguenther@suse.de>
Subject: [PATCH] Clear currently_expanding_gimple_stmt properly
Date: Mon, 28 Feb 2022 19:26:24 -0800	[thread overview]
Message-ID: <20220301032624.231501-1-hjl.tools@gmail.com> (raw)

commit a5883ba0de68efad36db145e75c86394d8bd44ea
Author: Michael Matz <matz@gcc.gnu.org>
Date:   Tue Nov 24 15:37:32 2009 +0000

introduced currently_expanding_gimple_stmt, which was set and cleared in
expand_gimple_basic_block when expanding gimple statement to RTL.  But it
isn't cleared when expand_gimple_basic_block returns inside the loop.

	PR middle-end/104721
	* cfgexpand.cc (expand_gimple_basic_block): Clear
	currently_expanding_gimple_stmt when returning inside the loop.
---
 gcc/cfgexpand.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index d51af2e3084..87536ec7ccd 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -5927,7 +5927,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 	{
 	  new_bb = expand_gimple_cond (bb, as_a <gcond *> (stmt));
 	  if (new_bb)
-	    return new_bb;
+	    {
+	      currently_expanding_gimple_stmt = NULL;
+	      return new_bb;
+	    }
 	}
       else if (is_gimple_debug (stmt))
 	{
@@ -6049,7 +6052,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 		  if (can_fallthru)
 		    bb = new_bb;
 		  else
-		    return new_bb;
+		    {
+		      currently_expanding_gimple_stmt = NULL;
+		      return new_bb;
+		    }
 		}
 	    }
 	  else
-- 
2.35.1


             reply	other threads:[~2022-03-01  3:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  3:26 H.J. Lu [this message]
2022-03-01  6:22 ` Richard Biener

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=20220301032624.231501-1-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=matz@suse.de \
    --cc=rguenther@suse.de \
    /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).