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

--- Comment #5 from Robert Dubner <rdubner at gcc dot gnu.org> ---
In the course of adding some new features to the COBOL front end, I ran across
the same problem.  I only dimly understand what's going on here; it has
something to do with "splitting the edge" when jumping to a cold partition.

I am enclosing a second program that exposed the problem in a slightly
different way.  I am also enclosing a patch created by OpenAI GPT-6.1 Sol Light
that fixes both, and provides regression testing for the fix.

I present the patch here only because I mediated the AI's work, but it needs
review by somebody who can look at it and say, "Yeah, that makes sense."  That
person is not me.

Here's the AI's explanation:

~~~~~~~~

Both C reproducers hit the same assertion in fix_up_fall_thru_edges. When
bbpart splits a crossing fallthrough, another transfer can still target the
original destination. The assertion assumed that only asm goto could leave that
extra successor. In the two reproducers, the surviving edge is an abnormal call
edge to a nonlocal receiver or the conditional abort edge from x86 XBEGIN. The
patch restores EDGE_CROSSING on the surviving edge regardless of its kind.

On x86-64 Linux, I reproduced the ICE with both tests before the fix and
verified that both pass the targeted check-gcc run afterward. I also verified
that the XBEGIN test compiles in 32-bit mode and that the existing PR108596 asm
goto test still compiles at -O2.

Reply via email to