public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3
@ 2024-06-14 19:07 patrick at rivosinc dot com
  2024-06-14 23:36 ` [Bug rtl-optimization/115495] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: patrick at rivosinc dot com @ 2024-06-14 19:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115495
           Summary: [15 Regression] ICE in smallest_mode_for_size, at
                    stor-layout.cc:356 during combine on RISC-V
                    rv64gcv_zvl256b at -O3
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
extern short a[];
short b;
int main() {
  for (char c = 0; c < 18; c += 1)
    a[c + 0] = b;
}

Backtrace:
> /scratch/tc-testing/tc-jun-14/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -march=rv64gcv_zvl256b -O3 red.c -o red.out
during RTL pass: combine
./red.c: In function 'main':
./red.c:6:1: internal compiler error: in smallest_mode_for_size, at
stor-layout.cc:356
    6 | }
      | ^
0x134a8f7 smallest_mode_for_size(poly_int<2u, unsigned long>, mode_class)
        ../../../gcc/gcc/stor-layout.cc:356
0x11fa32a smallest_int_mode_for_size(poly_int<2u, unsigned long>)
        ../../../gcc/gcc/machmode.h:916
0x11fa32a get_best_extraction_insn
        ../../../gcc/gcc/optabs-query.cc:208
0x25f7d54 make_extraction
        ../../../gcc/gcc/combine.cc:7779
0x25f903f make_compound_operation_int
        ../../../gcc/gcc/combine.cc:8186
0x25fa07f make_compound_operation(rtx_def*, rtx_code)
        ../../../gcc/gcc/combine.cc:8471
0x25fddce simplify_set
        ../../../gcc/gcc/combine.cc:6975
0x25fddce combine_simplify_rtx
        ../../../gcc/gcc/combine.cc:6374
0x260006f subst
        ../../../gcc/gcc/combine.cc:5630
0x2604101 try_combine
        ../../../gcc/gcc/combine.cc:3312
0x2609351 combine_instructions
        ../../../gcc/gcc/combine.cc:1264
0x2609351 rest_of_handle_combine
        ../../../gcc/gcc/combine.cc:15127
0x2609351 execute
        ../../../gcc/gcc/combine.cc:15171
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/zTf5nWz48

Found via fuzzer.

The fuzzer first detected this on 2024-06-07 and many times since so it was
likely caused by a patch committed a day or two before 2024-06-07.

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

* [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3
  2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
@ 2024-06-14 23:36 ` pinskia at gcc dot gnu.org
  2024-06-14 23:47 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-14 23:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0
                 CC|                            |pinskia at gcc dot gnu.org
          Component|middle-end                  |rtl-optimization

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

* [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3
  2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
  2024-06-14 23:36 ` [Bug rtl-optimization/115495] " pinskia at gcc dot gnu.org
@ 2024-06-14 23:47 ` pinskia at gcc dot gnu.org
  2024-06-14 23:48 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-14 23:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-14

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Trying 25 -> 26:
   25: r150:DI=r139:V16HI#0 0>>0x10
   26: r151:DI=zero_extend(r150:DI#0)

That is these 2 instructions:
```
(insn 25 24 26 2 (set (reg:DI 150)
        (lshiftrt:DI (subreg:DI (reg:V16HI 139 [ vect_cst__21 ]) 0)
            (const_int 16 [0x10]))) "/app/example.c":5:14 299 {lshrdi3}
     (nil))
(insn 26 25 34 2 (set (reg:DI 151)
        (zero_extend:DI (subreg:HI (reg:DI 150) 0))) "/app/example.c":5:14 121
{*zero_extendhidi2}
     (expr_list:REG_DEAD (reg:DI 150)
        (nil)))
```
The above rtl looks good as far as I know. It looks like
get_best_extraction_insn is using V16HI there though which is where it goes
wrong.

Confirmed.

This comes from the expanision of:
;; MEM <vector(16) short int> [(short int *)&a] = vect_cst__21;

Which looks different for GCC 14.1.0 and much simplier.

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

* [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3
  2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
  2024-06-14 23:36 ` [Bug rtl-optimization/115495] " pinskia at gcc dot gnu.org
  2024-06-14 23:47 ` pinskia at gcc dot gnu.org
@ 2024-06-14 23:48 ` pinskia at gcc dot gnu.org
  2024-06-19 16:13 ` rdapp at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-14 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note in most cases `(subreg:DI (reg:V16HI 139 [ vect_cst__21 ]) 0) (const_int
16 [0x10])` would normally be a `vec_select` so I am shock that it is using a
subreg here ...

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

* [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3
  2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
                   ` (2 preceding siblings ...)
  2024-06-14 23:48 ` pinskia at gcc dot gnu.org
@ 2024-06-19 16:13 ` rdapp at gcc dot gnu.org
  2024-06-20  3:33 ` patrick at rivosinc dot com
  2024-06-20 18:14 ` [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 since r15-1042-g68b0742a49d patrick at rivosinc dot com
  5 siblings, 0 replies; 7+ messages in thread
From: rdapp at gcc dot gnu.org @ 2024-06-19 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Robin Dapp <rdapp at gcc dot gnu.org> ---
At first it looked very weird that we need 50 (or so) instructions to expand

;; MEM <vector(16) short int> [(short int *)&a] = vect_cst__21;

but then I realized that all the hoops we jump through are due to possible
misalignment.  Otherwise we could of course just emit a vector store.

So we don't ICE with -mno-vector-strict-align.

Going to look into the actual issue in the next days.

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

* [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3
  2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
                   ` (3 preceding siblings ...)
  2024-06-19 16:13 ` rdapp at gcc dot gnu.org
@ 2024-06-20  3:33 ` patrick at rivosinc dot com
  2024-06-20 18:14 ` [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 since r15-1042-g68b0742a49d patrick at rivosinc dot com
  5 siblings, 0 replies; 7+ messages in thread
From: patrick at rivosinc dot com @ 2024-06-20  3:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Patrick O'Neill <patrick at rivosinc dot com> ---
This failure also appears when compiling glibc 2.39 with rv64gcv_zvl512b and
rv64gcv_zvl1024b.

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

* [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 since r15-1042-g68b0742a49d
  2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
                   ` (4 preceding siblings ...)
  2024-06-20  3:33 ` patrick at rivosinc dot com
@ 2024-06-20 18:14 ` patrick at rivosinc dot com
  5 siblings, 0 replies; 7+ messages in thread
From: patrick at rivosinc dot com @ 2024-06-20 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick O'Neill <patrick at rivosinc dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[15 Regression] ICE in      |[15 Regression] ICE in
                   |smallest_mode_for_size, at  |smallest_mode_for_size, at
                   |stor-layout.cc:356 during   |stor-layout.cc:356 during
                   |combine on RISC-V           |combine on RISC-V
                   |rv64gcv_zvl256b at -O3      |rv64gcv_zvl256b at -O3
                   |                            |since r15-1042-g68b0742a49d

--- Comment #5 from Patrick O'Neill <patrick at rivosinc dot com> ---
Bisected to first bad commit: r15-1042-g68b0742a49d

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

end of thread, other threads:[~2024-06-20 18:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 19:07 [Bug middle-end/115495] New: [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 patrick at rivosinc dot com
2024-06-14 23:36 ` [Bug rtl-optimization/115495] " pinskia at gcc dot gnu.org
2024-06-14 23:47 ` pinskia at gcc dot gnu.org
2024-06-14 23:48 ` pinskia at gcc dot gnu.org
2024-06-19 16:13 ` rdapp at gcc dot gnu.org
2024-06-20  3:33 ` patrick at rivosinc dot com
2024-06-20 18:14 ` [Bug rtl-optimization/115495] [15 Regression] ICE in smallest_mode_for_size, at stor-layout.cc:356 during combine on RISC-V rv64gcv_zvl256b at -O3 since r15-1042-g68b0742a49d patrick at rivosinc dot com

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