public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly
@ 2022-02-28 23:17 hjl.tools at gmail dot com
  2022-02-28 23:43 ` [Bug middle-end/104721] " hjl.tools at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-28 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

            Bug ID: 104721
           Summary: currently_expanding_gimple_stmt isn't cleared properly
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

expand_gimple_basic_block has

      currently_expanding_gimple_stmt = stmt;
...
         if (new_bb)
            return new_bb; <<< currently_expanding_gimple_stmt isn't cleared.
...
               if (new_bb)
                {
                  if (can_fallthru)
                    bb = new_bb;
                  else
                    return new_bb;  <<< currently_expanding_gimple_stmt isn't
cleared.
                }

  currently_expanding_gimple_stmt = NULL;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
@ 2022-02-28 23:43 ` hjl.tools at gmail dot com
  2022-02-28 23:43 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-28 23:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 52528
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52528&action=edit
A patch

I am testing this.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
  2022-02-28 23:43 ` [Bug middle-end/104721] " hjl.tools at gmail dot com
@ 2022-02-28 23:43 ` hjl.tools at gmail dot com
  2022-03-01 12:53 ` matz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-28 23:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-28
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
  2022-02-28 23:43 ` [Bug middle-end/104721] " hjl.tools at gmail dot com
  2022-02-28 23:43 ` hjl.tools at gmail dot com
@ 2022-03-01 12:53 ` matz at gcc dot gnu.org
  2022-03-01 13:56 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: matz at gcc dot gnu.org @ 2022-03-01 12:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #2 from Michael Matz <matz at gcc dot gnu.org> ---
Is there a testcase where you noticed this, or was it just reading code?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2022-03-01 12:53 ` matz at gcc dot gnu.org
@ 2022-03-01 13:56 ` hjl.tools at gmail dot com
  2022-03-01 14:04 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2022-03-01 13:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Michael Matz from comment #2)
> Is there a testcase where you noticed this, or was it just reading code?

I am working on a patch to check currently_expanding_gimple_stmt != NULL
in i386 backend.  At -O2, currently_expanding_gimple_stmt isn't NULL outside
of gimple to RTL expansion when compiling libgomp.fortran/reduction1.f90.
I tracked it down to expand_gimple_basic_block.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2022-03-01 13:56 ` hjl.tools at gmail dot com
@ 2022-03-01 14:04 ` jakub at gcc dot gnu.org
  2022-03-01 14:18 ` cvs-commit at gcc dot gnu.org
  2022-03-03  3:19 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-01 14:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Perhaps use C++ RAII for this?
Something like make_temp_override in the C++ FE.
Then next time somebody adds an early return it wouldn't need to be adjusted.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2022-03-01 14:04 ` jakub at gcc dot gnu.org
@ 2022-03-01 14:18 ` cvs-commit at gcc dot gnu.org
  2022-03-03  3:19 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-01 14:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:88f91d8ccc8fec3a811975e3e4765b9a94d3f764

commit r12-7429-g88f91d8ccc8fec3a811975e3e4765b9a94d3f764
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 28 15:18:04 2022 -0800

    Clear currently_expanding_gimple_stmt properly

    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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly
  2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2022-03-01 14:18 ` cvs-commit at gcc dot gnu.org
@ 2022-03-03  3:19 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2022-03-03  3:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 12.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-03  3:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 23:17 [Bug middle-end/104721] New: currently_expanding_gimple_stmt isn't cleared properly hjl.tools at gmail dot com
2022-02-28 23:43 ` [Bug middle-end/104721] " hjl.tools at gmail dot com
2022-02-28 23:43 ` hjl.tools at gmail dot com
2022-03-01 12:53 ` matz at gcc dot gnu.org
2022-03-01 13:56 ` hjl.tools at gmail dot com
2022-03-01 14:04 ` jakub at gcc dot gnu.org
2022-03-01 14:18 ` cvs-commit at gcc dot gnu.org
2022-03-03  3:19 ` hjl.tools at gmail dot com

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).