This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/40710] New: SH: gcc-4.3.4 miscompiles linux kernel for sh4-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]