[Bug middle-end/122773] [16 Regression] ice in collect_fallthrough_labels, at gimplify.cc:2694 since r16-4212

2025-11-21 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122773

Jakub Jelinek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Priority|P3  |P1
   Keywords|needs-bisection,|
   |needs-reduction |

--- Comment #7 from Jakub Jelinek  ---
Fixed.

[Bug middle-end/122773] [16 Regression] ice in collect_fallthrough_labels, at gimplify.cc:2694 since r16-4212

2025-11-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122773

--- Comment #6 from GCC Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:3012aad2dc6318ab490c4a2511f5b2e4d30652b9

commit r16-5482-g3012aad2dc6318ab490c4a2511f5b2e4d30652b9
Author: Jakub Jelinek 
Date:   Fri Nov 21 11:25:27 2025 +0100

gimplify: Fix ICE in collect_fallthrough_labels [PR122773]

In r16-4212 I had to tweak two spots in the gimplifier to ignore
gotos jumping to labels with the new VACUOUS_INIT_LABEL_P flag
(set by C++ FE when implementing goto/case interceptors with
extra .DEFERRED_INIT calls, so that jumps over vacuous initialization
are handled properly with the C++26 erroneous behavior requirements).
Except as the following testcase shows, the checks blindly assumed
that gimple_goto_dest operand is a LABEL_DECL, which is not the case
for computed jumps.

The following patch checks that gimple_goto_dest argument is a LABEL_DECL
before testing VACUOUS_INIT_LABEL_P flag on it.

2025-11-21  Jakub Jelinek  

PR middle-end/122773
* gimplify.cc (collect_fallthrough_labels): Check whether
gimple_goto_dest is a LABEL_DECL before testing
VACUOUS_INIT_LABEL_P.
(expand_FALLTHROUGH_r): Likewise.

* gcc.dg/pr122773.c: New test.

[Bug middle-end/122773] [16 Regression] ice in collect_fallthrough_labels, at gimplify.cc:2694 since r16-4212

2025-11-20 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122773

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2025-11-20
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #5 from Jakub Jelinek  ---
Created attachment 62862
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62862&action=edit
gcc16-pr122773.patch

Untested fix.  Thanks for the report.