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 tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host


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

Mikael Pettersson <mikpelinux at gmail dot com> changed:

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

--- Comment #17 from Mikael Pettersson <mikpelinux at gmail dot com> ---
This bug also affects m68k-linux, since it doesn't set need_64bit_hwint=yes.

On m68k-linux, gcc-4.8 -O1 -fomit-frame-pointer generates:

pa_ldil_cint_p:
        move.l %d2,-(%sp)
        move.l 8(%sp),%d0
        move.l 12(%sp),%d1
        and.l #-2147481601,%d1
        move.l %d0,%d2
        or.l %d1,%d2
        jeq .L3
        move.w #-1,%a0
        move.l #-2147483648,%a1
        cmp.l %a0,%d0
        jne .L4
        cmp.l %a1,%d1
.L4:
        seq %d0
        extb.l %d0
        neg.l %d0
        jra .L2
.L3:
        moveq #1,%d0
.L2:
        move.l (%sp)+,%d2
        rts

while gcc-4.9 generates:

pa_ldil_cint_p:
        move.l 8(%sp),%d0
        and.l #2047,%d0
        seq %d0
        neg.b %d0
        and.l #255,%d0
        rts

The gcc-4.9 code completely ignores the high 32-bits.

I'll try the patch in a couple of days when my current 4.9 bootstrap+regtest is
done.


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