[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-03-02 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |12.0

--- Comment #6 from H.J. Lu  ---
Fixed for GCC 12.

[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-03-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #5 from CVS Commits  ---
The master branch has been updated by H.J. Lu :

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

commit r12-7429-g88f91d8ccc8fec3a811975e3e4765b9a94d3f764
Author: H.J. Lu 
Date:   Mon Feb 28 15:18:04 2022 -0800

Clear currently_expanding_gimple_stmt properly

commit a5883ba0de68efad36db145e75c86394d8bd44ea
Author: Michael Matz 
Date:   Tue Nov 24 15:37:32 2009 +

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.

[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-03-01 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
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.

[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-03-01 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #3 from H.J. Lu  ---
(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.

[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-03-01 Thread matz at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #2 from Michael Matz  ---
Is there a testcase where you noticed this, or was it just reading code?

[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-02-28 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

H.J. Lu  changed:

   What|Removed |Added

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

[Bug middle-end/104721] currently_expanding_gimple_stmt isn't cleared properly

2022-02-28 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104721

--- Comment #1 from H.J. Lu  ---
Created attachment 52528
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52528=edit
A patch

I am testing this.