public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above
@ 2023-02-15 14:37 zsojka at seznam dot cz
  2023-02-15 19:37 ` [Bug rtl-optimization/108805] " ubizjak at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2023-02-15 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108805
           Summary: [13 Regression] ICE: in simplify_subreg, at
                    simplify-rtx.cc:7400 at -O and above
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

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

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O testcase.c
during RTL pass: combine
testcase.c: In function 'foo':
testcase.c:16:1: internal compiler error: in simplify_subreg, at
simplify-rtx.cc:7400
   16 | }
      | ^
0x79d82a simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:7400
0x13a9438 simplify_context::simplify_gen_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:7694
0x13a9438 simplify_context::simplify_gen_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
        /repo/gcc-trunk/gcc/simplify-rtx.cc:7694
0x23c8a32 simplify_gen_subreg(machine_mode, rtx_def*, machine_mode,
poly_int<1u, unsigned long>)
        /repo/gcc-trunk/gcc/rtl.h:3535
0x23c8a32 if_then_else_cond
        /repo/gcc-trunk/gcc/combine.cc:9375
0x23c8535 if_then_else_cond
        /repo/gcc-trunk/gcc/combine.cc:9240
0x23ddd0c combine_simplify_rtx
        /repo/gcc-trunk/gcc/combine.cc:5723
0x23e01eb subst
        /repo/gcc-trunk/gcc/combine.cc:5605
0x23e00e8 subst
        /repo/gcc-trunk/gcc/combine.cc:5532
0x23e3831 try_combine
        /repo/gcc-trunk/gcc/combine.cc:3336
0x23ebca0 combine_instructions
        /repo/gcc-trunk/gcc/combine.cc:1287
0x23ebca0 rest_of_handle_combine
        /repo/gcc-trunk/gcc/combine.cc:14978
0x23ebca0 execute
        /repo/gcc-trunk/gcc/combine.cc:15023
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.

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

* [Bug rtl-optimization/108805] [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above
  2023-02-15 14:37 [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above zsojka at seznam dot cz
@ 2023-02-15 19:37 ` ubizjak at gmail dot com
  2023-02-16  7:40 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2023-02-15 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-02-15
          Component|target                      |rtl-optimization
     Ever confirmed|0                           |1

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed, combine chokes itself with the RTX it cannot chew:

(gdb) bt
#0  internal_error (gmsgid=gmsgid@entry=0x2614840 "in %s, at %s:%d") at
../../git/gcc/gcc/diagnostic.cc:2138
#1  0x0000000000891812 in fancy_abort (file=file@entry=0x20b75d8
"../../git/gcc/gcc/simplify-rtx.cc", line=line@entry=7400, 
    function=function@entry=0x20b74e8 "simplify_subreg") at
../../git/gcc/gcc/diagnostic.cc:2242
#2  0x00000000007653cb in simplify_context::simplify_subreg
(this=0x7fffffffd2a8, outermode=<optimized out>, op=<optimized out>, 
    innermode=<optimized out>, byte=...) at
../../git/gcc/gcc/simplify-rtx.cc:7400
#3  0x0000000000ecfee9 in simplify_context::simplify_gen_subreg
(this=<optimized out>, outermode=E_V4QImode, op=0x7fffea209480, 
    innermode=E_VOIDmode, byte=...) at ../../git/gcc/gcc/simplify-rtx.cc:7694
#4  0x0000000000ecfee9 in simplify_context::simplify_gen_subreg
(this=this@entry=0x7fffffffd2a8, 
    outermode=outermode@entry=E_V4QImode, op=0x7fffea3e4b58,
innermode=E_DImode, byte=...) at ../../git/gcc/gcc/simplify-rtx.cc:7694
#5  0x0000000001c92bde in simplify_gen_subreg (byte=..., innermode=<optimized
out>, op=<optimized out>, outermode=E_V4QImode)
    at ../../git/gcc/gcc/rtl.h:3408
#6  if_then_else_cond (x=x@entry=0x7fffea3e4558,
ptrue=ptrue@entry=0x7fffffffd328, pfalse=pfalse@entry=0x7fffffffd338)
    at ../../git/gcc/gcc/combine.cc:9375
#7  0x0000000001c929b1 in if_then_else_cond (x=x@entry=0x7fffea3e42b8,
ptrue=ptrue@entry=0x7fffffffd400, 
    pfalse=pfalse@entry=0x7fffffffd408) at ../../git/gcc/gcc/combine.cc:9240
#8  0x0000000001c9de0a in combine_simplify_rtx (x=0x7fffea3e42b8,
op0_mode=E_V4QImode, in_dest=0, in_cond=0)
    at ../../git/gcc/gcc/combine.cc:5723

(gdb) f 3
#3  0x0000000000ecfee9 in simplify_context::simplify_gen_subreg
(this=<optimized out>, outermode=E_V4QImode, op=0x7fffea209480, 
    innermode=E_VOIDmode, byte=...) at ../../git/gcc/gcc/simplify-rtx.cc:7694
7694      newx = simplify_subreg (outermode, op, innermode, byte);
(gdb) p debug_rtx (op)
(const_int -1 [0xffffffffffffffff])

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

* [Bug rtl-optimization/108805] [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above
  2023-02-15 14:37 [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above zsojka at seznam dot cz
  2023-02-15 19:37 ` [Bug rtl-optimization/108805] " ubizjak at gmail dot com
@ 2023-02-16  7:40 ` ubizjak at gmail dot com
  2023-02-17 15:04 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2023-02-16  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
             Status|NEW                         |ASSIGNED

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Patch in testing:

--cut here--
diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index 0a1dd88b0a8..281bc418df0 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -7664,7 +7664,7 @@ simplify_context::simplify_subreg (machine_mode
outermode, rtx op,
                            0).exists (&int_outermode))
     {
       rtx tem = simplify_subreg (int_outermode, op, innermode, byte);
-      if (tem)
+      if (tem && GET_MODE (tem) != VOIDmode)
        return simplify_gen_subreg (outermode, tem, GET_MODE (tem), 0);
     }

--cut here--

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

* [Bug rtl-optimization/108805] [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above
  2023-02-15 14:37 [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above zsojka at seznam dot cz
  2023-02-15 19:37 ` [Bug rtl-optimization/108805] " ubizjak at gmail dot com
  2023-02-16  7:40 ` ubizjak at gmail dot com
@ 2023-02-17 15:04 ` cvs-commit at gcc dot gnu.org
  2023-02-17 15:20 ` ubizjak at gmail dot com
  2023-02-17 15:21 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-17 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:6ac3ebed5ffbac0d81c5a1d0cb1e345cfad202a8

commit r13-6117-g6ac3ebed5ffbac0d81c5a1d0cb1e345cfad202a8
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Fri Feb 17 15:58:12 2023 +0100

    simplify-rtx: Fix VOIDmode operand handling in simplify_subreg [PR108805]

    simplify_subreg can return VOIDmode const_int operand and will
    cause ICE in simplify_gen_subreg when this operand is passed to it.

    The patch uses int_outermode instead of GET_MODE of temporary as the
    innermode argument of simplify_gen_subreg.

    2023-02-17  Uroš Bizjak  <ubizjak@gmail.com>

    gcc/ChangeLog:

            PR target/108805
            * simplify-rtx.cc (simplify_context::simplify_subreg): Use
            int_outermode instead of GET_MODE (tem) to prevent
            VOIDmode from entering simplify_gen_subreg.

    gcc/testsuite/ChangeLog:

            PR target/108805
            * gcc.dg/pr108805.c: New test.

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

* [Bug rtl-optimization/108805] [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above
  2023-02-15 14:37 [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2023-02-17 15:04 ` cvs-commit at gcc dot gnu.org
@ 2023-02-17 15:20 ` ubizjak at gmail dot com
  2023-02-17 15:21 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2023-02-17 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Caused by g:d45ec8a732f4

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

* [Bug rtl-optimization/108805] [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above
  2023-02-15 14:37 [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2023-02-17 15:20 ` ubizjak at gmail dot com
@ 2023-02-17 15:21 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2023-02-17 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed.

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

end of thread, other threads:[~2023-02-17 15:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 14:37 [Bug target/108805] New: [13 Regression] ICE: in simplify_subreg, at simplify-rtx.cc:7400 at -O and above zsojka at seznam dot cz
2023-02-15 19:37 ` [Bug rtl-optimization/108805] " ubizjak at gmail dot com
2023-02-16  7:40 ` ubizjak at gmail dot com
2023-02-17 15:04 ` cvs-commit at gcc dot gnu.org
2023-02-17 15:20 ` ubizjak at gmail dot com
2023-02-17 15:21 ` ubizjak at gmail 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).