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 c/40757] gcc 4.4.0 miscompiles mpfr-2.4.1



------- Comment #11 from jakub at gcc dot gnu dot org  2009-07-16 14:07 -------
You haven't mentioned what options you compiled this file with.  So, assuming
-O2, I see:
        add     %i4, -1, %l5    ! n,, tmp186
        sethi   %hi(1073740800), %o2    !, tmp189
        sll     %l5, 2, %l5     ! tmp186,, D.4491
        or      %o2, 1023, %o2  ! tmp189,, tmp188
        st      %g1, [%i0+%l5]  !,* D.4491
        add     %i4, %o2, %o2   ! n, tmp188, tmp187
        mov     %i0, %o0        ! a,
        sll     %o2, 2, %o2     ! tmp187,,
        call    memset, 0       !,
         mov    0, %o1  !,
for this memset call, which looks correct to me.  The st %g1, [%i0+%l5] line
stores to %i0 a[n-1] and memset is called with memset (a, 0, (n + 0x3fffffffU)
<< 2);  So, if this doesn't work (and you see the same), you hit a bug in
Solaris memset implementation, which doesn't handle properly length with
garbage in upper 32-bits, guess it could use brz,pn %o2, do_nothing or
something similar, which is fine for 64-bit code, but certainly not for 32-bit
code.


-- 


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


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