public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
@ 2023-06-12 11:33 daniel at rozsnyo dot com
  2023-06-12 16:13 ` [Bug rtl-optimization/110220] [13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: daniel at rozsnyo dot com @ 2023-06-12 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110220
           Summary: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel at rozsnyo dot com
  Target Milestone: ---

Created attachment 55308
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55308&action=edit
Code that fails to compile

After I migrated from gcc-4.8/4.9 to recent versions, both the gcc-14.0.0 and
gcc-13.1.1 fail to compile my pretty large avr-mcu project at one specific
function/construct. While I have found a solution with making the code
differently constructed to not trigger the ICE, now that I found time, I did
reduce the output of the  -save-temps into a single function that triggers the
assertion.


during RTL pass: jump
insn-bug-minimal.c: In function ‘cmd_parse’:
insn-bug-minimal.c:184:1: internal compiler error: in patch_jump_insn, at
cfgrtl.cc:1295
  184 | }
      | ^
0x90de427 internal_error(char const*, ...)
        ???:0
0x820f6af fancy_abort(char const*, int, char const*)
        ???:0
0x835a3be redirect_edge_and_branch(edge_def*, basic_block_def*)
        ???:0
0x8dc2b15 cleanup_cfg(int)
        ???:0


The way to avoid this ICE is to comment out one of the switch(state) cases, or
move one of them before the switch into an if-statement (my current function
equivalent workaround).

My cross-compile toolchain is made by gentoo crossdev package.

The ICE seems to be present only at -Os for the attached minimal source:
avr-gcc -g -Os -Wall -mmcu=atxmega128a4u -std=gnu99 -c insn-bug-minimal.c -o
bug.o

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
@ 2023-06-12 16:13 ` pinskia at gcc dot gnu.org
  2023-06-12 16:22 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.2
            Summary|ICE in patch_jump_insn, at  |[13/14 Regression] ICE in
                   |cfgrtl.cc:1295 - avr/xmega  |patch_jump_insn, at
                   |                            |cfgrtl.cc:1295 - avr/xmega
      Known to work|                            |12.1.0
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |13.1.0, 14.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like a latent bug in the RTL optimizers.

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
  2023-06-12 16:13 ` [Bug rtl-optimization/110220] [13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-06-12 16:22 ` pinskia at gcc dot gnu.org
  2023-06-12 16:25 ` daniel at rozsnyo dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55310
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55310&action=edit
Reduced as I can get it

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
  2023-06-12 16:13 ` [Bug rtl-optimization/110220] [13/14 Regression] " pinskia at gcc dot gnu.org
  2023-06-12 16:22 ` pinskia at gcc dot gnu.org
@ 2023-06-12 16:25 ` daniel at rozsnyo dot com
  2023-06-12 16:28 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: daniel at rozsnyo dot com @ 2023-06-12 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Daniel Rozsnyo <daniel at rozsnyo dot com> ---
The ICE is triggered in gcc 13 and 14 versions only.

Added gcc 11 and 12 to my gentoo crossdev - it compiles without ICE assertion
on those.

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (2 preceding siblings ...)
  2023-06-12 16:25 ` daniel at rozsnyo dot com
@ 2023-06-12 16:28 ` pinskia at gcc dot gnu.org
  2023-06-12 16:28 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
#2  0x0000000000dfafd8 in patch_jump_insn (insn=0x7ffff7775360,
old_label=0x7ffff760c840, new_bb=0x7ffff776a000) at ../../gcc/cfgrtl.cc:1295
1295              gcc_assert (JUMP_LABEL (insn) == old_label);
(gdb) p debug_rtx(insn)
(jump_insn 143 142 139 3 (parallel [
            (set (pc)
                (if_then_else (gtu (reg:HI 57)
                        (const_int 6 [0x6]))
                    (label_ref 60)
                    (pc)))
            (clobber (scratch:QI))
        ]) "t.c":12:9 683 {*cbranchhi4}
     (nil))
$1 = void

Which is checking the state before the switch table.

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (3 preceding siblings ...)
  2023-06-12 16:28 ` pinskia at gcc dot gnu.org
@ 2023-06-12 16:28 ` pinskia at gcc dot gnu.org
  2023-06-30 16:29 ` gjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-06-12
             Status|UNCONFIRMED                 |NEW

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Daniel Rozsnyo from comment #3)
> The ICE is triggered in gcc 13 and 14 versions only.
> 
> Added gcc 11 and 12 to my gentoo crossdev - it compiles without ICE
> assertion on those.

Yes it looks like it is only in GCC 13+. I tested it via https://godbolt.org/ .

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (4 preceding siblings ...)
  2023-06-12 16:28 ` pinskia at gcc dot gnu.org
@ 2023-06-30 16:29 ` gjl at gcc dot gnu.org
  2023-07-27  9:26 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-06-30 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

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

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
I can reproduce Andi's testcase, and with -fdisable-rtl-avr-casesi the ICE goes
away.  Hence

1) This is just an accident, or

2) There is a bug in avr-specific pass avr-casesi (as dumped with
-fdump-rtl-avr-casesi) like wrong RTL-sharing or such, or

3) cfgrtl's assertion is too strict and effectively disallows such
target-specific (optimization) passes.

I don't currently have time to look into this in a timely manner.

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (5 preceding siblings ...)
  2023-06-30 16:29 ` gjl at gcc dot gnu.org
@ 2023-07-27  9:26 ` rguenth at gcc dot gnu.org
  2023-08-01 11:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (6 preceding siblings ...)
  2023-07-27  9:26 ` rguenth at gcc dot gnu.org
@ 2023-08-01 11:51 ` cvs-commit at gcc dot gnu.org
  2023-08-01 13:02 ` cvs-commit at gcc dot gnu.org
  2023-08-01 13:05 ` [Bug target/110220] " gjl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-01 11:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:1d379bb1191390c3be1fdd0f2fb8e8b1e2c44cd7

commit r14-2907-g1d379bb1191390c3be1fdd0f2fb8e8b1e2c44cd7
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Tue Aug 1 13:49:17 2023 +0200

    target/110220: Set JUMP_LABEL and LABEL_NUSES of new branch insn generated
by

    target specific RTL optimization pass .avr-casesi.

    gcc/
            PR target/110220
            * config/avr/avr.cc (avr_optimize_casesi): Set JUMP_LABEL and
            LABEL_NUSES of new conditional branch instruction.

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

* [Bug rtl-optimization/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (7 preceding siblings ...)
  2023-08-01 11:51 ` cvs-commit at gcc dot gnu.org
@ 2023-08-01 13:02 ` cvs-commit at gcc dot gnu.org
  2023-08-01 13:05 ` [Bug target/110220] " gjl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-01 13:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:07573fc45a1fefa7e5f03e1930b188f36eba3a11

commit r13-7678-g07573fc45a1fefa7e5f03e1930b188f36eba3a11
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Tue Aug 1 13:49:17 2023 +0200

    target/110220: Set JUMP_LABEL and LABEL_NUSES of new branch insn generated
by

    target specific RTL optimization pass .avr-casesi.

    gcc/
            PR target/110220
            * config/avr/avr.cc (avr_optimize_casesi): Set JUMP_LABEL and
            LABEL_NUSES of new conditional branch instruction.

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

* [Bug target/110220] [13/14 Regression] ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega
  2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
                   ` (8 preceding siblings ...)
  2023-08-01 13:02 ` cvs-commit at gcc dot gnu.org
@ 2023-08-01 13:05 ` gjl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-08-01 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
          Component|rtl-optimization            |target

--- Comment #10 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Fixed in v13.3+.

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

end of thread, other threads:[~2023-08-01 13:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 11:33 [Bug rtl-optimization/110220] New: ICE in patch_jump_insn, at cfgrtl.cc:1295 - avr/xmega daniel at rozsnyo dot com
2023-06-12 16:13 ` [Bug rtl-optimization/110220] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-06-12 16:22 ` pinskia at gcc dot gnu.org
2023-06-12 16:25 ` daniel at rozsnyo dot com
2023-06-12 16:28 ` pinskia at gcc dot gnu.org
2023-06-12 16:28 ` pinskia at gcc dot gnu.org
2023-06-30 16:29 ` gjl at gcc dot gnu.org
2023-07-27  9:26 ` rguenth at gcc dot gnu.org
2023-08-01 11:51 ` cvs-commit at gcc dot gnu.org
2023-08-01 13:02 ` cvs-commit at gcc dot gnu.org
2023-08-01 13:05 ` [Bug target/110220] " gjl at gcc dot gnu.org

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