public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat,  at reg-stack.c:1386
       [not found] <bug-39856-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-09  3:51 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09  3:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ygepes at gmail dot com

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 50316 has been marked as a duplicate of this bug. ***

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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-05-22 19:01 ` vmakarov at gcc dot gnu dot org
@ 2009-05-28 22:39 ` jakub at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-28 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jakub at gcc dot gnu dot org  2009-05-28 22:39 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-05-22 19:00 ` vmakarov at gcc dot gnu dot org
@ 2009-05-22 19:01 ` vmakarov at gcc dot gnu dot org
  2009-05-28 22:39 ` jakub at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: vmakarov at gcc dot gnu dot org @ 2009-05-22 19:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from vmakarov at gcc dot gnu dot org  2009-05-22 19:01 -------
Subject: Bug 39856

Author: vmakarov
Date: Fri May 22 19:00:45 2009
New Revision: 147804

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147804
Log:
2009-05-22 Vladimir Makarov <vmakarov@redhat.com>

        PR target/39856
        * reg-stack.c (subst_stack_regs_pat): Remove gcc_assert for note
        for clobber.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reg-stack.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-05-21 14:07 ` jakub at gcc dot gnu dot org
@ 2009-05-22 19:00 ` vmakarov at gcc dot gnu dot org
  2009-05-22 19:01 ` vmakarov at gcc dot gnu dot org
  2009-05-28 22:39 ` jakub at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: vmakarov at gcc dot gnu dot org @ 2009-05-22 19:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from vmakarov at gcc dot gnu dot org  2009-05-22 18:59 -------
Subject: Bug 39856

Author: vmakarov
Date: Fri May 22 18:59:30 2009
New Revision: 147803

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147803
Log:
2009-05-22 Vladimir Makarov <vmakarov@redhat.com>

        PR target/39856
        * reg-stack.c (subst_stack_regs_pat): Remove gcc_assert for note
        for clobber.


Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/reg-stack.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-05-05 15:56 ` mmitchel at gcc dot gnu dot org
@ 2009-05-21 14:07 ` jakub at gcc dot gnu dot org
  2009-05-22 19:00 ` vmakarov at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-21 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2009-05-21 14:07 -------
Patch has been posted almost a month ago:
http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01926.html
Vlad, could you please ping it?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
  2009-04-23 18:15 ` [Bug target/39856] [4.4/4.5 " jakub at gcc dot gnu dot org
  2009-04-24 15:54 ` vmakarov at redhat dot com
@ 2009-05-05 15:56 ` mmitchel at gcc dot gnu dot org
  2009-05-21 14:07 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2009-05-05 15:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
  2009-04-23 18:15 ` [Bug target/39856] [4.4/4.5 " jakub at gcc dot gnu dot org
@ 2009-04-24 15:54 ` vmakarov at redhat dot com
  2009-05-05 15:56 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vmakarov at redhat dot com @ 2009-04-24 15:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from vmakarov at redhat dot com  2009-04-24 15:53 -------
In gcc4.4 we have before reg-stack.c

(insn 96 82 97 4 /home/vmakarov/build/bb.ii:8 (parallel [
            (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
                        (const_int 28 [0x1c])) [0 S4 A32])
                (fix:SI (reg:DF 9 st(1))))
            (clobber (reg:XF 9 st(1)))
        ]) 119 {fix_truncsi_i387_fisttp} (expr_list:REG_DEAD (reg:DF 9 st(1))
        (nil)))

in subst_stack_regs first it is changed to 

(insn:TI 96 82 97 4 /home/vmakarov/build/bb.ii:8 (parallel [
            (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
                        (const_int 28 [0x1c])) [0 S4 A32])
                (fix:SI (reg:DF 8 st)))
            (clobber (reg:XF 9 st(1)))
        ]) 119 {fix_truncsi_i387_fisttp} (expr_list:REG_DEAD (reg:DF 8 st)
        (nil)))

Then it is trying to change clobber and fail because there is no note
about dead or unused reg 9, it fails in subst_stack_regs_pat on the
assert:

                if (note)
                  emit_pop_insn (insn, regstack, *dest, EMIT_BEFORE);
                else
                  {
                    note = find_reg_note (insn, REG_UNUSED, *dest);
                    gcc_assert (note);
                  }


The gcc4.3 has analogous insn before reg-stack.c

(insn 106 92 107 4 bb.ii:8 (parallel [
            (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
                        (const_int 28 [0x1c])) [0 S4 A8])
                (fix:SI (reg:DF 11 st(3))))
            (clobber (reg:XF 11 st(3)))
        ]) 159 {fix_truncsi_i387_fisttp} (expr_list:REG_DEAD (reg:DF 11 st(3))
        (expr_list:REG_UNUSED (reg:XF 11 st(3))
            (nil))))

The difference is in presense of REG_UNUSED (reg:XF 11 st(3)) which
does not permit the gcc_assert aborts gcc4.3.  The note is present
because LR_OUT at BB 4 does not contain 11 st(3).  Quite opposite, 9
st(1) is in LR_OUT at BB 4 in gcc4.4.  Therefore REG_UNUSED note is
not generated for gcc4.4.

So why there is such difference in LR_OUT for 4.3 vs 4.4?  Gcc4.3 is
lucky to use 11 st (3) only in BB3 (where insn 116 is placed).  Gcc4.4
uses 9 st(1) in insn 96 and reuses it in many other BBs.  Because of
partially set register for variable R, we got that LR_OUT is set up in
BB 3.  If somebody is interesting here is the CFG with LR_OUT & LR_IN
and usage of 9 st (1):

0
|
v
2-->
|  |
v  |
3->|  lr_out:9                 set 9;use 9;clobber 9
|  |
v  |
4  |  lr_out:9                 call
|  |
v  |
5<-   lr_in:9 lr_out:9
|\
| \
6->|  lr_out:9                 set 9
|  |
|  |
7  |  lr_in:9 lr_out:9         use 9 .. set 9
|  |
|  |
8<-   lr_in:9 lr_out:9
|\
| \
9  |  lr_in:9                  use 9
|  |
|  |
10<-

So the code 

                if (note)
                  emit_pop_insn (insn, regstack, *dest, EMIT_BEFORE);
                else
                  {
                    note = find_reg_note (insn, REG_UNUSED, *dest);
                    gcc_assert (note);
                  }

does not take situation of reusage of hard register for partially set
variable.

IMHO, the code should be

Index: reg-stack.c
===================================================================
--- reg-stack.c (revision 146648)
+++ reg-stack.c (working copy)
@@ -1381,11 +1381,9 @@ subst_stack_regs_pat (rtx insn, stack re
                if (note)
                  emit_pop_insn (insn, regstack, *dest, EMIT_BEFORE);
                else
-                 {
-                   note = find_reg_note (insn, REG_UNUSED, *dest);
-                   gcc_assert (note);
-                 }
-               remove_note (insn, note);
+                 note = find_reg_note (insn, REG_UNUSED, *dest);
+               if (note)
+                 remove_note (insn, note);
                replace_reg (dest, FIRST_STACK_REG + 1);
              }
            else

I'll send the patch soon.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

* [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386
  2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
@ 2009-04-23 18:15 ` jakub at gcc dot gnu dot org
  2009-04-24 15:54 ` vmakarov at redhat dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 18:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.4.0 4.5.0
      Known to work|                            |4.3.3
            Summary|[4.4 Regression] ICE in     |[4.4/4.5 Regression] ICE in
                   |subst_stack_regs_pat, at    |subst_stack_regs_pat, at
                   |reg-stack.c:1386            |reg-stack.c:1386
   Target Milestone|---                         |4.4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856


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

end of thread, other threads:[~2021-08-09  3:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-39856-4@http.gcc.gnu.org/bugzilla/>
2021-08-09  3:51 ` [Bug target/39856] [4.4/4.5 Regression] ICE in subst_stack_regs_pat, at reg-stack.c:1386 pinskia at gcc dot gnu.org
2009-04-22 21:08 [Bug target/39856] New: [4.4 " rguenth at gcc dot gnu dot org
2009-04-23 18:15 ` [Bug target/39856] [4.4/4.5 " jakub at gcc dot gnu dot org
2009-04-24 15:54 ` vmakarov at redhat dot com
2009-05-05 15:56 ` mmitchel at gcc dot gnu dot org
2009-05-21 14:07 ` jakub at gcc dot gnu dot org
2009-05-22 19:00 ` vmakarov at gcc dot gnu dot org
2009-05-22 19:01 ` vmakarov at gcc dot gnu dot org
2009-05-28 22:39 ` jakub at gcc dot gnu dot 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).