public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
@ 2024-05-17 17:55 patrick at rivosinc dot com
  2024-05-17 18:04 ` [Bug target/115142] " ewlu at rivosinc dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: patrick at rivosinc dot com @ 2024-05-17 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115142
           Summary: [14/15 Regression] Unrecognizable insn in
                    extract_insn, at recog.cc:2812 with -ftree-ter
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
long a;
char b;
void e() {
  char f[8][1];
  b = f[a][a];
}

Backtrace:
> /scratch/tc-testing/tc-apr-4/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -ftree-ter red.c
red.c: In function 'e':
red.c:6:1: error: unrecognizable insn:
    6 | }
      | ^
(insn 6 5 7 2 (set (reg:DI 138)
        (ashift:DI (mem/c:DI (symbol_ref:DI ("a") [flags 0x6] <var_decl
0x75ae5321cb40 a>) [1 a+0 S8 A64])
            (const_int 1 [0x1]))) "red.c":5:11 -1
     (nil))
during RTL pass: vregs
red.c:6:1: internal compiler error: in extract_insn, at recog.cc:2812
0xa97591 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../../gcc/gcc/rtl-error.cc:108
0xa975b3 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../../gcc/gcc/rtl-error.cc:116
0xa95e87 extract_insn(rtx_insn*)
        ../../../gcc/gcc/recog.cc:2812
0xf5e21e instantiate_virtual_regs_in_insn
        ../../../gcc/gcc/function.cc:1611
0xf5e21e instantiate_virtual_regs
        ../../../gcc/gcc/function.cc:1994
0xf5e21e execute
        ../../../gcc/gcc/function.cc:2041
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Godbolt: https://godbolt.org/z/ab7eh3o3E

Affects RISC-V, Loongarch64

Found via fuzzer.

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

* [Bug target/115142] [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
@ 2024-05-17 18:04 ` ewlu at rivosinc dot com
  2024-05-18 14:23 ` law at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ewlu at rivosinc dot com @ 2024-05-17 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

Edwin Lu <ewlu at rivosinc dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ewlu at rivosinc dot com

--- Comment #1 from Edwin Lu <ewlu at rivosinc dot com> ---
For riscv bisected down to r14-3111-ga16dc729fda to be the first bad commit.
Also seems to only affect -O0 (O1 doesn't ICE https://godbolt.org/z/vTffqqjev)

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

* [Bug target/115142] [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
  2024-05-17 18:04 ` [Bug target/115142] " ewlu at rivosinc dot com
@ 2024-05-18 14:23 ` law at gcc dot gnu.org
  2024-05-18 21:30 ` law at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-05-18 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
So just one high level note.  Nobody is ever going to do something like
"-ftree-ter" without having one of the optimization levels on.  It's an option
combination that just doesn't make sense.

But we still shouldn't trigger aborts, ICEs and such. 


I think this is a minor bug in the mem_shadd_or_shadd_rtx_p function.  It
probably should be verifying that the value being shifted is a REG.

Testing a fix.

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

* [Bug target/115142] [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
  2024-05-17 18:04 ` [Bug target/115142] " ewlu at rivosinc dot com
  2024-05-18 14:23 ` law at gcc dot gnu.org
@ 2024-05-18 21:30 ` law at gcc dot gnu.org
  2024-05-18 21:30 ` law at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-05-18 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-18
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

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

* [Bug target/115142] [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
                   ` (2 preceding siblings ...)
  2024-05-18 21:30 ` law at gcc dot gnu.org
@ 2024-05-18 21:30 ` law at gcc dot gnu.org
  2024-05-19 15:57 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-05-18 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug target/115142] [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
                   ` (3 preceding siblings ...)
  2024-05-18 21:30 ` law at gcc dot gnu.org
@ 2024-05-19 15:57 ` cvs-commit at gcc dot gnu.org
  2024-05-21  6:31 ` [Bug target/115142] [14 " rguenth at gcc dot gnu.org
  2024-05-21 13:24 ` law at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-19 15:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

https://gcc.gnu.org/g:e1ce9c37ed68136a99d44c8301990c184ba41849

commit r15-652-ge1ce9c37ed68136a99d44c8301990c184ba41849
Author: Jeff Law <jlaw@ventanamicro.com>
Date:   Sun May 19 09:56:16 2024 -0600

    [to-be-committed][RISC-V][PR target/115142] Do not create invalidate
shift-add insn

    The circumstances which triggered this weren't something that should appear
in
    the wild (-ftree-ter, without optimization enabled).  So I wasn't planning
to
    backport.  Obviously if it shows up in another context we can revisit that
    decision.

    I've run this through my rv32gcv and rv64gc tester.  Waiting on the CI
system before committing.

            PR target/115142
    gcc/

            * config/riscv/riscv.cc (mem_shadd_or_shadd_rtx_p): Make sure
            shifted argument is a register.

    gcc/testsuite

            * gcc.target/riscv/pr115142.c: New test.

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

* [Bug target/115142] [14 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
                   ` (4 preceding siblings ...)
  2024-05-19 15:57 ` cvs-commit at gcc dot gnu.org
@ 2024-05-21  6:31 ` rguenth at gcc dot gnu.org
  2024-05-21 13:24 ` law at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-21  6:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14/15 Regression]          |[14 Regression]
                   |Unrecognizable insn in      |Unrecognizable insn in
                   |extract_insn, at            |extract_insn, at
                   |recog.cc:2812 with          |recog.cc:2812 with
                   |-ftree-ter                  |-ftree-ter
   Target Milestone|---                         |14.2
      Known to work|                            |15.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
fixed on trunk I guess.

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

* [Bug target/115142] [14 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter
  2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
                   ` (5 preceding siblings ...)
  2024-05-21  6:31 ` [Bug target/115142] [14 " rguenth at gcc dot gnu.org
@ 2024-05-21 13:24 ` law at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-05-21 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Yes, sorry.  I should have removed the 15 tag.

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

end of thread, other threads:[~2024-05-21 13:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17 17:55 [Bug target/115142] New: [14/15 Regression] Unrecognizable insn in extract_insn, at recog.cc:2812 with -ftree-ter patrick at rivosinc dot com
2024-05-17 18:04 ` [Bug target/115142] " ewlu at rivosinc dot com
2024-05-18 14:23 ` law at gcc dot gnu.org
2024-05-18 21:30 ` law at gcc dot gnu.org
2024-05-18 21:30 ` law at gcc dot gnu.org
2024-05-19 15:57 ` cvs-commit at gcc dot gnu.org
2024-05-21  6:31 ` [Bug target/115142] [14 " rguenth at gcc dot gnu.org
2024-05-21 13:24 ` law 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).