NetBSD-Bugs archive

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

port-mips/57680: printf("%.1f") shows wrong results on R3000 mipseb



>Number:         57680
>Category:       port-mips
>Synopsis:       printf("%.1f") shows wrong results on R3000 mipseb
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 01 19:20:00 +0000 2023
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.3
>Organization:
>Environment:
System: NetBSD galant 9.3_STABLE NetBSD 9.3_STABLE (GENERIC) #9: Sun Oct 29 06:09:59 JST 2023  tsutsui@mirage:/s/netbsd-9/src/sys/arch/newsmips/compile/GENERIC newsmips (userland binaries are from NetBSD 9.3 release)
Architecture: mipseb
Machine: mipseb
>Description:
On NetBSD/newsmips 9.3 on NWS-3470 (maybe also other R3000 machines)
printf with "%.1f" shows wrong results.

>How-To-Repeat:
news3470-% uname -pr
9.3_STABLE mipseb
news3470-% file /usr/bin/cc
/usr/bin/cc: ELF 32-bit MSB pie executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 9.3, not stripped
news3470-% cc --version
cc (nb4 20200810) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

news3470-% ps aux
USER      PID %CPU %MEM   VSZ   RSS TTY   STAT STARTED      TIME COMMAND
root    18704  _.0  1.0  6484  1188 ?     R     3:56AM   7:28.92 find / ( ! -fs
tsutsui 15542  C.0  2.0  6768  1320 pts/0 O+    4:10AM   0:00.67 ps -aux
root        0  ;.0  4.0     0  2968 ?     DKl  Tue01AM 124:22.81 [system]
root      541  0.E  0.5  7004   328 ?     S    Tue07PM   8:49.04 rlogind -L
root        1  0.0  0.0  6636     0 ?     Is   Tue01AM   0:01.04 init
root      173  0.0  1.0 11668   740 ?     Ss   Tue01AM   0:20.59 /usr/sbin/sysl

 :

news3470-% cat test.c
#include <stdio.h>

int
main(int argc, char *argv[])
{
        float f;

        f = 3.14159 * 100;
        printf("%.1f\n", f);
        printf("%d\n", (int)f);

        f = f * 5;
        printf("%.1f\n", f);
        printf("%d\n", (int)f);
}
news3470-% cc test.c
news3470-% ./a.out
300.0
314
?00.0
1570
news3470-% 

>Fix:
Unknown.
If it works on MIPS3 machines or emulators, there are
some hazard problems in asm sources?
---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index