public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/40710]  New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux
@ 2009-07-10  9:55 sugioka at itonet dot co dot jp
  2009-07-10  9:58 ` [Bug target/40710] " sugioka at itonet dot co dot jp
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: sugioka at itonet dot co dot jp @ 2009-07-10  9:55 UTC (permalink / raw)
  To: gcc-bugs

gcc-4.3.4 miscompiles kernel-2.6.30 for sh4-linux.
Reproduce: sh-linux-gcc -O2 -m4a-nofpu -ml -fomit-frame-pointer -S balloc.i
attached code is compiled as follows.

ext3_get_group_desc:
        mov.w   .L10,r1
        sts.l   pr,@-r15
        add     r4,r1
        mov.l   @(28,r1),r2
        mov.l   @(36,r2),r3
        cmp/hi  r5,r3
        bf/s    .L8                 !!!
        add     #-4,r15             !!!
        mov.l   @(28,r1),r1
        mov.l   @(56,r2),r3
        mov     r1,r2
        add     #64,r2
        mov.l   @(32,r1),r7
        mov.l   @(20,r2),r1
        mov     r5,r2
        add     #-1,r7
        neg     r1,r1
        shld    r1,r2
        mov     r2,r0
        shll2   r0
        mov.l   @(r0,r3),r1
        tst     r1,r1
        bt/s    .L9
        and     r5,r7
        tst     r6,r6
        bt/s    .L5
        mov.l   @(20,r1),r2
        mov.l   r1,@r6
.L5:
        mov     #5,r1
        mov     r7,r0
        shld    r1,r0
        add     r2,r0
.L3:
        lds.l   @r15+,pr
        rts     
        nop
        .align 5
.L8:
        mov.l   .L14,r1
        mov     r5,r7
        mov.l   .L15,r5
        mov.l   .L13,r6
        jsr     @r1
        mov.l   r3,@r15
        mov     #0,r0
        bra     .L3
        add     #4,r15
        .align 5
.L9:
        mov.l   .L14,r1
        add     #-8,r15
        mov.l   r7,@(4,r15)
        mov     r5,r7
        mov.l   .L15,r5
        mov.l   .L16,r6
        jsr     @r1
        mov.l   r2,@r15
        mov     #0,r0
        bra     .L3
        add     #8,r15

I found that reverting patch for pr40105
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147781 fixes this.
The difference between this code and working code which is generated by
r147781-reverted gcc follows.
--- balloc.s    2009-07-10 17:00:27.000000000 +0900
+++ balloc.s.revert-pr40105     2009-07-10 17:00:20.000000000 +0900
@@ -23,8 +23,7 @@
        mov.l   @(28,r1),r2
        mov.l   @(36,r2),r3
        cmp/hi  r5,r3
-       bf/s    .L8
-       add     #-4,r15
+       bf      .L8
        mov.l   @(28,r1),r1
        mov.l   @(56,r2),r3
        mov     r1,r2
@@ -57,6 +56,7 @@
        .align 5
 .L8:
        mov.l   .L14,r1
+       add     #-4,r15
        mov     r5,r7
        mov.l   .L15,r5
        mov.l   .L13,r6


-- 
           Summary: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sh-unknown-linux-gnu


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


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

* [Bug target/40710] SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
@ 2009-07-10  9:58 ` sugioka at itonet dot co dot jp
  2009-07-11 13:14 ` kkojima at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sugioka at itonet dot co dot jp @ 2009-07-10  9:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sugioka at itonet dot co dot jp  2009-07-10 09:57 -------
Created an attachment (id=18171)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18171&action=view)
preprocessed source

preprocessed source


-- 


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


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

* [Bug target/40710] SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
  2009-07-10  9:58 ` [Bug target/40710] " sugioka at itonet dot co dot jp
@ 2009-07-11 13:14 ` kkojima at gcc dot gnu dot org
  2009-07-14 12:15 ` [Bug rtl-optimization/40710] [4.3.4 regression] Linux kernel miscompiled " ebotcazou at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-07-11 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kkojima at gcc dot gnu dot org  2009-07-11 13:14 -------
I've tried to see what is going on.   fill_slots_from_thread
fills wrongly the delay slot of a conditional jmp insn with
"add #-4,r15" where r15 is the stack pointer register for SH.
fill_slots_from_thread computes the resource set for
the follow-through block with

mark_target_live_regs (get_insns (), opposite_thread, &opposite_needed);

and mark_target_live_regs uses df_get_live_in to get live regs
for the basic block including the opposite_thread insn which is

the first insn of the follow-through block:

(insn 32 46 35 fs/ext3/balloc.c:66 (parallel [
            (asm_operands/v ("") ("") 0 []
                 [] 2935777)
            (clobber (mem:BLK (scratch) [0 A8]))
        ]) -1 (nil))

The resulting opssite_needed is

$1 = {memory = 0x1, unch_memory = 0x0, volatil = 0x0, cc = 0x0,
      regs = {0xf6,  0x0, 0x0, 0x0, 0x40000}}

i.e. it seems that df_get_live_in doesn't count r15 as an live
register and fill_slots_from_thread picks "add #-4,r15" up as
an eligible insn to fill that delayed slot.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Priority|P3                          |P4
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-11 13:14:17
               date|                            |


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


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

* [Bug rtl-optimization/40710] [4.3.4 regression] Linux kernel miscompiled for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
  2009-07-10  9:58 ` [Bug target/40710] " sugioka at itonet dot co dot jp
  2009-07-11 13:14 ` kkojima at gcc dot gnu dot org
@ 2009-07-14 12:15 ` ebotcazou at gcc dot gnu dot org
  2009-07-14 12:33 ` [Bug rtl-optimization/40710] [4.3 Regression] " rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2009-07-14 12:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major
          Component|target                      |rtl-optimization
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
            Summary|SH: gcc-4.3.4 miscompiles   |[4.3.4 regression] Linux
                   |linux kernel for sh4-linux  |kernel miscompiled for sh4-
                   |                            |linux
   Target Milestone|---                         |4.3.4


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


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

* [Bug rtl-optimization/40710] [4.3 Regression] Linux kernel miscompiled for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
                   ` (2 preceding siblings ...)
  2009-07-14 12:15 ` [Bug rtl-optimization/40710] [4.3.4 regression] Linux kernel miscompiled " ebotcazou at gcc dot gnu dot org
@ 2009-07-14 12:33 ` rguenth at gcc dot gnu dot org
  2009-07-15 21:33 ` kkojima at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-14 12:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-07-14 12:32 -------
If 4.3.3 worked please add that release in the known-to-work field.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.3.4
            Summary|[4.3.4 regression] Linux    |[4.3 Regression] Linux
                   |kernel miscompiled for sh4- |kernel miscompiled for sh4-
                   |linux                       |linux


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


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

* [Bug rtl-optimization/40710] [4.3 Regression] Linux kernel miscompiled for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
                   ` (3 preceding siblings ...)
  2009-07-14 12:33 ` [Bug rtl-optimization/40710] [4.3 Regression] " rguenth at gcc dot gnu dot org
@ 2009-07-15 21:33 ` kkojima at gcc dot gnu dot org
  2009-07-18  6:47 ` kkojima at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-07-15 21:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kkojima at gcc dot gnu dot org  2009-07-15 21:32 -------
Subject: Bug 40710

Author: kkojima
Date: Wed Jul 15 21:32:46 2009
New Revision: 149696

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149696
Log:
        PR rtl-optimization/40710
        * resource.c (mark_target_live_regs): Reset DF problem to LR.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/resource.c


-- 


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


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

* [Bug rtl-optimization/40710] [4.3 Regression] Linux kernel miscompiled for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
                   ` (4 preceding siblings ...)
  2009-07-15 21:33 ` kkojima at gcc dot gnu dot org
@ 2009-07-18  6:47 ` kkojima at gcc dot gnu dot org
  2009-07-18 11:31 ` rguenth at gcc dot gnu dot org
  2009-07-22 23:22 ` kkojima at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-07-18  6:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kkojima at gcc dot gnu dot org  2009-07-18 06:47 -------
Subject: Bug 40710

Author: kkojima
Date: Sat Jul 18 06:47:22 2009
New Revision: 149764

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149764
Log:
        PR rtl-optimization/40710
        * resource.c (mark_target_live_regs): Reset DF problem to LR.


Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/resource.c


-- 


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


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

* [Bug rtl-optimization/40710] [4.3 Regression] Linux kernel miscompiled for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
                   ` (5 preceding siblings ...)
  2009-07-18  6:47 ` kkojima at gcc dot gnu dot org
@ 2009-07-18 11:31 ` rguenth at gcc dot gnu dot org
  2009-07-22 23:22 ` kkojima at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-18 11:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-07-18 11:31 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|4.3.3                       |4.3.3 4.3.4
         Resolution|                            |FIXED


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


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

* [Bug rtl-optimization/40710] [4.3 Regression] Linux kernel miscompiled for sh4-linux
  2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
                   ` (6 preceding siblings ...)
  2009-07-18 11:31 ` rguenth at gcc dot gnu dot org
@ 2009-07-22 23:22 ` kkojima at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-07-22 23:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kkojima at gcc dot gnu dot org  2009-07-22 23:22 -------
Subject: Bug 40710

Author: kkojima
Date: Wed Jul 22 23:22:24 2009
New Revision: 149965

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149965
Log:
        Backport from mainline:
        2009-07-15  Eric Botcazou  <ebotcazou@adacore.com>

        PR rtl-optimization/40710
        * resource.c (mark_target_live_regs): Reset DF problem to LR.


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


-- 


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


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

end of thread, other threads:[~2009-07-22 23:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10  9:55 [Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux sugioka at itonet dot co dot jp
2009-07-10  9:58 ` [Bug target/40710] " sugioka at itonet dot co dot jp
2009-07-11 13:14 ` kkojima at gcc dot gnu dot org
2009-07-14 12:15 ` [Bug rtl-optimization/40710] [4.3.4 regression] Linux kernel miscompiled " ebotcazou at gcc dot gnu dot org
2009-07-14 12:33 ` [Bug rtl-optimization/40710] [4.3 Regression] " rguenth at gcc dot gnu dot org
2009-07-15 21:33 ` kkojima at gcc dot gnu dot org
2009-07-18  6:47 ` kkojima at gcc dot gnu dot org
2009-07-18 11:31 ` rguenth at gcc dot gnu dot org
2009-07-22 23:22 ` kkojima 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).