public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0
@ 2022-05-24  6:55 zsojka at seznam dot cz
  2022-05-24  7:42 ` [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2022-05-24  6:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105711
           Summary: [12/13 Regression] ICE: in simplify_subreg, at
                    simplify-rtx.cc:7346 with -O2
                    --param=sccvn-max-alias-queries-per-access=0
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Created attachment 53027
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53027&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O2 --param=sccvn-max-alias-queries-per-access=0
testcase.c 
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:6:5: internal compiler error: in simplify_subreg, at
simplify-rtx.cc:7346
    6 |   c /= 3040;
      |   ~~^~~~~~~
0x789ae6 simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:7346
0x138ff89 simplify_context::simplify_gen_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:7624
0xfa0b6f simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, poly_int<1u,
unsigned long>)
        /repo/gcc-trunk/gcc/rtl.h:3534
0xfa0b6f extract_bit_field_as_subreg
        /repo/gcc-trunk/gcc/expmed.cc:1621
0xfa64ee extract_bit_field_1
        /repo/gcc-trunk/gcc/expmed.cc:1829
0xfa77c7 extract_bit_field(rtx_def*, poly_int<1u, unsigned long>, poly_int<1u,
unsigned long>, int, rtx_def*, machine_mode, machine_mode, bool, rtx_def**)
        /repo/gcc-trunk/gcc/expmed.cc:2137
0xfc58aa read_complex_part(rtx_def*, bool)
        /repo/gcc-trunk/gcc/expr.cc:3554
0xfd0c18 expand_assignment(tree_node*, tree_node*, bool)
        /repo/gcc-trunk/gcc/expr.cc:5586
0xe85887 expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.cc:3935
0xe85887 expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.cc:4033
0xe8bb68 expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.cc:6085
0xe8dd17 execute
        /repo/gcc-trunk/gcc/cfgexpand.cc:6811
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.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-723-20220524082011-g1adf11822bd-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-723-20220524082011-g1adf11822bd-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220524 (experimental) (GCC)

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

* [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb
  2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
@ 2022-05-24  7:42 ` marxin at gcc dot gnu.org
  2022-05-24  7:58 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-24  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-24
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |ubizjak at gmail dot com
             Status|UNCONFIRMED                 |NEW
            Summary|[12/13 Regression] ICE: in  |[12/13 Regression] ICE: in
                   |simplify_subreg, at         |simplify_subreg, at
                   |simplify-rtx.cc:7346 with   |simplify-rtx.cc:7346 with
                   |-O2                         |-O2
                   |--param=sccvn-max-alias-que |--param=sccvn-max-alias-que
                   |ries-per-access=0           |ries-per-access=0 since
                   |                            |r12-6173-g9ff206d3865df5cb

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-6173-g9ff206d3865df5cb.

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

* [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb
  2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
  2022-05-24  7:42 ` [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb marxin at gcc dot gnu.org
@ 2022-05-24  7:58 ` rguenth at gcc dot gnu.org
  2022-05-24  7:58 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-24  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We are expanding

MEM <vector(2) char> [(char *)&c] = { 0, 0 };

with 'c' expanded as

(concat:CQI (reg/v:QI 93 [ c ])
    (reg/v:QI 94 [ c+1 ]))

doing read_complex_part from

(subreg:CQI (const_vector:V2QI [
            (const_int 0 [0]) repeated x2
        ]) 0)

which is a) a missed subreg simplification (do we have const complex in RTL?).

We get into extract_bit_field_1 which eventually does

  /* Make sure we are playing with integral modes.  Pun with subregs
     if we aren't.  */
  opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (op0));
  scalar_int_mode imode;
  if (!op0_mode.exists (&imode) || imode != GET_MODE (op0))
    {
      if (MEM_P (op0))
        op0 = adjust_bitfield_address_size (op0, op0_mode.else_blk (),
                                            0, MEM_SIZE (op0));
      else if (op0_mode.exists (&imode))
        {
          op0 = gen_lowpart (imode, op0);

getting us a HImode (const_int 0 [0]) as op0.  But extract_bit_field_as_subreg
which eventually ICEs only gets op0 but not its mode ...

I'm testing a patch.

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

* [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb
  2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
  2022-05-24  7:42 ` [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb marxin at gcc dot gnu.org
  2022-05-24  7:58 ` rguenth at gcc dot gnu.org
@ 2022-05-24  7:58 ` rguenth at gcc dot gnu.org
  2022-05-24 10:12 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-24  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |12.2
           Priority|P3                          |P2
             Status|NEW                         |ASSIGNED

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

* [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb
  2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-05-24  7:58 ` rguenth at gcc dot gnu.org
@ 2022-05-24 10:12 ` cvs-commit at gcc dot gnu.org
  2022-06-02  9:40 ` [Bug rtl-optimization/105711] [12 " cvs-commit at gcc dot gnu.org
  2022-06-02  9:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-24 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:91c7c5edd2c1d31bf379be1d077b39644391cc31

commit r13-727-g91c7c5edd2c1d31bf379be1d077b39644391cc31
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 24 10:09:25 2022 +0200

    middle-end/105711 - properly handle CONST_INT when expanding bitfields

    This is another place where we fail to pass down the mode of a
    CONST_INT.

    2022-05-24  Richard Biener  <rguenther@suse.de>

            PR middle-end/105711
            * expmed.cc (extract_bit_field_as_subreg): Add op0_mode parameter
            and use it.
            (extract_bit_field_1): Pass down the mode of op0 to
            extract_bit_field_as_subreg.

            * gcc.target/i386/pr105711.c: New testcase.

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

* [Bug rtl-optimization/105711] [12 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb
  2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2022-05-24 10:12 ` cvs-commit at gcc dot gnu.org
@ 2022-06-02  9:40 ` cvs-commit at gcc dot gnu.org
  2022-06-02  9:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-02  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

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

commit r12-8451-gcdd93e5b88e6aab832509d7aabed6cfd2d014c58
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 24 10:09:25 2022 +0200

    middle-end/105711 - properly handle CONST_INT when expanding bitfields

    This is another place where we fail to pass down the mode of a
    CONST_INT.

    2022-05-24  Richard Biener  <rguenther@suse.de>

            PR middle-end/105711
            * expmed.cc (extract_bit_field_as_subreg): Add op0_mode parameter
            and use it.
            (extract_bit_field_1): Pass down the mode of op0 to
            extract_bit_field_as_subreg.

            * gcc.target/i386/pr105711.c: New testcase.

    (cherry picked from commit 91c7c5edd2c1d31bf379be1d077b39644391cc31)

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

* [Bug rtl-optimization/105711] [12 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb
  2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2022-06-02  9:40 ` [Bug rtl-optimization/105711] [12 " cvs-commit at gcc dot gnu.org
@ 2022-06-02  9:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-02  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|12.1.1                      |12.1.0
      Known to work|                            |12.1.1
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-06-02  9:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24  6:55 [Bug rtl-optimization/105711] New: [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 zsojka at seznam dot cz
2022-05-24  7:42 ` [Bug rtl-optimization/105711] [12/13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7346 with -O2 --param=sccvn-max-alias-queries-per-access=0 since r12-6173-g9ff206d3865df5cb marxin at gcc dot gnu.org
2022-05-24  7:58 ` rguenth at gcc dot gnu.org
2022-05-24  7:58 ` rguenth at gcc dot gnu.org
2022-05-24 10:12 ` cvs-commit at gcc dot gnu.org
2022-06-02  9:40 ` [Bug rtl-optimization/105711] [12 " cvs-commit at gcc dot gnu.org
2022-06-02  9:43 ` rguenth 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).