public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word,  at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b
@ 2020-04-16  7:21 marxin at gcc dot gnu.org
  2020-04-16  7:21 ` [Bug target/94614] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-16  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94614
           Summary: [10 Regression] ICE in emit_move_multi_word, at
                    expr.c:3716 since
                    r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-linux-gnu
            Target: arm-none-eabi-gcc,riscv64-linux-gnu

I see the following ICE

$ ./gcc/xgcc -Bgcc /home/marxin/Programming/gcc2/gcc/testsuite/gcc.dg/pr94574.c
-c -Og
during RTL pass: expand
/home/marxin/Programming/gcc2/gcc/testsuite/gcc.dg/pr94574.c: In function
‘foo’:
/home/marxin/Programming/gcc2/gcc/testsuite/gcc.dg/pr94574.c:13:18: internal
compiler error: in emit_move_multi_word, at expr.c:3716
   13 |   *(v4si *) &res = v;
      |   ~~~~~~~~~~~~~~~^~~
0xca66a2 emit_move_multi_word
        /home/marxin/Programming/gcc2/gcc/expr.c:3716
0xca6a56 emit_move_insn_1(rtx_def*, rtx_def*)
        /home/marxin/Programming/gcc2/gcc/expr.c:3791
0xca6cb1 emit_move_insn(rtx_def*, rtx_def*)
        /home/marxin/Programming/gcc2/gcc/expr.c:3850
0xc81b1a store_bit_field_1
        /home/marxin/Programming/gcc2/gcc/expmed.c:806
0xc835fa store_bit_field(rtx_def*, poly_int<1u, unsigned long>, poly_int<1u,
unsigned long>, poly_int<1u, unsigned long>, poly_int<1u, unsigned long>,
machine_mode, rtx_def*, bool)
        /home/marxin/Programming/gcc2/gcc/expmed.c:1172
0xcb408a store_field
        /home/marxin/Programming/gcc2/gcc/expr.c:7192
0xcabafc expand_assignment(tree_node*, tree_node*, bool)
        /home/marxin/Programming/gcc2/gcc/expr.c:5369
0xb25d0e expand_gimple_stmt_1
        /home/marxin/Programming/gcc2/gcc/cfgexpand.c:3749
0xb26107 expand_gimple_stmt
        /home/marxin/Programming/gcc2/gcc/cfgexpand.c:3847
0xb2e1d1 expand_gimple_basic_block
        /home/marxin/Programming/gcc2/gcc/cfgexpand.c:5887
0xb2fc15 execute
        /home/marxin/Programming/gcc2/gcc/cfgexpand.c:6542
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug target/94614] [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
@ 2020-04-16  7:21 ` marxin at gcc dot gnu.org
  2020-04-16  7:28 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-16  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-16
      Known to fail|                            |10.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.0
      Known to work|                            |9.3.0

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

* [Bug target/94614] [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
  2020-04-16  7:21 ` [Bug target/94614] " marxin at gcc dot gnu.org
@ 2020-04-16  7:28 ` rguenth at gcc dot gnu.org
  2020-04-16  7:36 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-16  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

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
             Status|NEW                         |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The testcase ICEs before the fix for PR94574, not sure how you bisected to the
offending rev?

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

* [Bug target/94614] [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
  2020-04-16  7:21 ` [Bug target/94614] " marxin at gcc dot gnu.org
  2020-04-16  7:28 ` rguenth at gcc dot gnu.org
@ 2020-04-16  7:36 ` marxin at gcc dot gnu.org
  2020-04-16  7:39 ` [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716 marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-16  7:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> The testcase ICEs before the fix for PR94574, not sure how you bisected to
> the offending rev?

Isn't only aarch64 affected? I'm talking about arm-none-eabi-gcc.

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

* [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-04-16  7:36 ` marxin at gcc dot gnu.org
@ 2020-04-16  7:39 ` marxin at gcc dot gnu.org
  2020-04-16  7:40 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-16  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10 Regression] ICE in      |ICE in
                   |emit_move_multi_word, at    |emit_move_multi_word, at
                   |expr.c:3716 since           |expr.c:3716
                   |r10-416-g1bf2a0b90f2457f6d9 |
                   |301535560eb5e05978261b      |

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #2)
> (In reply to Richard Biener from comment #1)
> > The testcase ICEs before the fix for PR94574, not sure how you bisected to
> > the offending rev?
> 
> Isn't only aarch64 affected? I'm talking about arm-none-eabi-gcc.

I take back. You are right! I grepped for a different ICE.

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

* [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-04-16  7:39 ` [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716 marxin at gcc dot gnu.org
@ 2020-04-16  7:40 ` rguenth at gcc dot gnu.org
  2020-04-16  7:53 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-16  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
#1  0x0000000000cecacc in emit_move_multi_word (mode=E_TImode, 
    x=0x7ffff69f66c0, y=0x7ffff69f64e0)
    at /space/rguenther/src/gcc/gcc/expr.c:3716
(gdb) p debug_rtx  (x)
(subreg:TI (reg/v:DI 113 [ res ]) 0)
$3 = void
(gdb) p debug_rtx  (y)
(reg/v:TI 115 [ v ])
$4 = void

so this is another part not expecting the "invalid" source writing
outside the bounds of a register.  We have

      /* Do not generate code for a move if it would come entirely
         from the undefined bits of a paradoxical subreg.  */
      if (undefined_operand_subword_p (y, i))
        continue;

but lack the same check for the x parts.  The following fixes it:

diff --git a/gcc/expr.c b/gcc/expr.c
index b97c217e86d..dfbeae71518 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3692,6 +3692,11 @@ emit_move_multi_word (machine_mode mode, rtx x, rtx y)
   need_clobber = false;
   for (i = 0; i < CEIL (mode_size, UNITS_PER_WORD); i++)
     {
+      /* Do not generate code for a move if it would go entirely
+        to the non-existing bits of a paradoxical subreg.  */
+      if (undefined_operand_subword_p (x, i))
+       continue;
+
       rtx xpart = operand_subword (x, i, 1, mode);
       rtx ypart;

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

* [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-04-16  7:40 ` rguenth at gcc dot gnu.org
@ 2020-04-16  7:53 ` rguenth at gcc dot gnu.org
  2020-04-16 10:55 ` cvs-commit at gcc dot gnu.org
  2020-04-16 10:55 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-16  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> but lack the same check for the x parts.  The following fixes it:
> 
> diff --git a/gcc/expr.c b/gcc/expr.c
> index b97c217e86d..dfbeae71518 100644
> --- a/gcc/expr.c
> +++ b/gcc/expr.c
> @@ -3692,6 +3692,11 @@ emit_move_multi_word (machine_mode mode, rtx x, rtx y)
>    need_clobber = false;
>    for (i = 0; i < CEIL (mode_size, UNITS_PER_WORD); i++)
>      {
> +      /* Do not generate code for a move if it would go entirely
> +        to the non-existing bits of a paradoxical subreg.  */
> +      if (undefined_operand_subword_p (x, i))
> +       continue;
> +
>        rtx xpart = operand_subword (x, i, 1, mode);
>        rtx ypart;

but only to get to the next one:

during RTL pass: subreg1
pr94574.c: In function ‘foo’:
pr94574.c:15:1: internal compiler error: in simplify_gen_subreg_concatn, at
lower-subreg.c:717
   15 | }
      | ^
0x1f7188d simplify_gen_subreg_concatn
        /space/rguenther/src/gcc/gcc/lower-subreg.c:717
0x1f72a3d resolve_clobber
        /space/rguenther/src/gcc/gcc/lower-subreg.c:1160
0x1f73e5b decompose_multiword_subregs
        /space/rguenther/src/gcc/gcc/lower-subreg.c:1610
0x1f743f5 execute
        /space/rguenther/src/gcc/gcc/lower-subreg.c:1765
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

#1  0x0000000001f7188e in simplify_gen_subreg_concatn (outermode=E_SImode, 
    op=0x7ffff69f66c0, innermode=E_TImode, byte=0)
    at /space/rguenther/src/gcc/gcc/lower-subreg.c:717
717               gcc_assert (!paradoxical_subreg_p (op));

where it tries to fixup

(clobber (subreg:TI (concatn/v:DI [
                (reg:SI 117 [ res ])
                (reg:SI 118 [ res+4 ])
            ]) 0))

but a clobber of a paradoxical subreg is simply the same as a clobber of
the SUBREG_REG (the concat in this case)?  Thus, fixed by

diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index a170f0ff93b..a11e535b5bf 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1150,6 +1150,10 @@ resolve_clobber (rtx pat, rtx_insn *insn)
   int ret;

   reg = XEXP (pat, 0);
+  /* For clobbers we can look through paradoxical subregs which
+     we do not handle in simplify_gen_subreg_concatn.  */
+  if (paradoxical_subreg_p (reg))
+    reg = SUBREG_REG (reg);
   if (!resolve_reg_p (reg) && !resolve_subreg_p (reg))
     return false;

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

* [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-04-16  7:53 ` rguenth at gcc dot gnu.org
@ 2020-04-16 10:55 ` cvs-commit at gcc dot gnu.org
  2020-04-16 10:55 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-16 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:eafeba3e5187a53a4c08a3285b4b220e1ab68b60

commit r10-7753-geafeba3e5187a53a4c08a3285b4b220e1ab68b60
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 16 09:37:44 2020 +0200

    middle-end/94614 - avoid multiword moves to nothing

    This adjusts emit_move_multi_word to handle moves into paradoxical
    subregs parts that are not there and adjusts lower-subregs
    CLOBBER resolving to deal with those as well.

    2020-04-16  Richard Biener  <rguenther@suse.de>

            PR middle-end/94614
            * expr.c (emit_move_multi_word): Do not generate code when
            the destination part is undefined_operand_subword_p.
            * lower-subreg.c (resolve_clobber): Look through a paradoxica
            subreg.

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

* [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716
  2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-04-16 10:55 ` cvs-commit at gcc dot gnu.org
@ 2020-04-16 10:55 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-16 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2020-04-16 10:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16  7:21 [Bug target/94614] New: [10 Regression] ICE in emit_move_multi_word, at expr.c:3716 since r10-416-g1bf2a0b90f2457f6d9301535560eb5e05978261b marxin at gcc dot gnu.org
2020-04-16  7:21 ` [Bug target/94614] " marxin at gcc dot gnu.org
2020-04-16  7:28 ` rguenth at gcc dot gnu.org
2020-04-16  7:36 ` marxin at gcc dot gnu.org
2020-04-16  7:39 ` [Bug target/94614] ICE in emit_move_multi_word, at expr.c:3716 marxin at gcc dot gnu.org
2020-04-16  7:40 ` rguenth at gcc dot gnu.org
2020-04-16  7:53 ` rguenth at gcc dot gnu.org
2020-04-16 10:55 ` cvs-commit at gcc dot gnu.org
2020-04-16 10:55 ` 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).