NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-mips/57680: printf("%.1f") shows wrong results onR3000mipseb



The following reply was made to PR port-mips/57680; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: port-mips/57680: printf("%.1f") shows wrong results
 onR3000mipseb
Date: Fri, 3 Nov 2023 23:35:20 +0000 (UTC)

 On Fri, 3 Nov 2023, Izumi Tsutsui wrote:
 
 > So at least gcc -O2 (including dtoa.c in libc.so) causes
 > something wrong on MIPS1.
 >
 
 Very intriguing results! Does adding an explicit arch flag like `-march=mips1'
 along with `-O2' help?
 
 > (I still wonder if it's compiler bug or improper implementation like
 >  undefined behaviour etc.)
 >
 
 I don't know anything about the MIPS arch. so I can't definitively say, but,
 IMO I think it's the code GCC is generating for MIPS1:
 
 a) One of the first things I tried on a recent 9.3_STABLE running on amd64
     was to try out different FE_* rounding modes--just like what you added.
     Compile with: cc -m32 -O2 -ffast-math (this last sometimes causes problems).
 
     No issues.
 
 b) Next I forced the FPU to do the rounding by calling fesetround(FE_*) first
     thing. This made some of the final bits in the precision differ, but, this
     is expected.
 
 c) The same binaries work on the newer MIPS arches.
 
 d) You say it works fine in an emulator.
 
 -RVP
 


Home | Main Index | Thread Index | Old Index