>Synopsis:      arm64 ilogbf(0.0) incorrect result, should be INT_MIN
>Category:      system
>Environment:
        System      : OpenBSD 6.8
        Details     : OpenBSD 6.8-current (GENERIC.MP) #871: Wed Oct 28 
10:16:14 MDT 2020
                         
[email protected]:/usr/src/sys/arch/arm64/compile/GENERIC.MP

        Architecture: OpenBSD.arm64
        Machine     : arm64
>Description:
        Sample program shows INT_MIN = -2147483648, ilogbf(0.0) is defined
        by the manpage as INT_MIN but comes out off-by-one, -2147483647.
        Same incorrect result from ilogb(0.0) as well.

        Note that amd64 is correct, so this is arch-specific.
>How-To-Repeat:
        The following code shows the result:

#include <stdio.h>
#include <math.h>     // ilogbf, pow
int
main() {
  printf(" ilogbf (%g) is %d, INT_MIN is %d\n",
    0.0, ilogbf(0.0), INT_MIN);
  printf(" ilogb (%g) is %d, INT_MIN is %d\n",
    0.0, ilogb(0.0), INT_MIN);
}

>Fix:
        Some kind of correction to ilogb(3), ilogbf(3)


dmesg:
OpenBSD 6.8-current (GENERIC.MP) #871: Wed Oct 28 10:16:14 MDT 2020
    [email protected]:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem  = 3075792896 (2933MB)
avail mem = 2948968448 (2812MB)
random: good seed from bootblocks
mainbus0 at root: ACPI
psci0 at mainbus0: PSCI 1.1, SMCCC 1.2
cpu0 at mainbus0 mpidr 0: ARM Cortex-A72 r0p3
cpu0: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu0: 1024KB 64b/line 16-way L2 cache
cpu0: CRC32
cpu1 at mainbus0 mpidr 1: ARM Cortex-A72 r0p3
cpu1: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu1: 1024KB 64b/line 16-way L2 cache
cpu1: CRC32
cpu2 at mainbus0 mpidr 2: ARM Cortex-A72 r0p3
cpu2: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu2: 1024KB 64b/line 16-way L2 cache
cpu2: CRC32
cpu3 at mainbus0 mpidr 3: ARM Cortex-A72 r0p3
cpu3: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu3: 1024KB 64b/line 16-way L2 cache
cpu3: CRC32
efi0 at mainbus0: UEFI 2.7
efi0: https://github.com/pftf/RPi4 rev 0x10000
smbios0 at efi0: SMBIOS 3.3.0
smbios0: vendor https://github.com/pftf/RPi4 version "UEFI Firmware v1.20" date 
09/01/2020
smbios0: Raspberry Pi Foundation Raspberry Pi 4 Model B
apm0 at mainbus0
ampintc0 at mainbus0 nirq 256, ncpu 4 ipi: 0, 1: "interrupt-controller"
agtimer0 at mainbus0: tick rate 54000 KHz
acpi0 at mainbus0: ACPI 6.3
acpi0: sleep states
acpi0: tables DSDT FACP CSRT DBG2 GTDT APIC PPTT SPCR
acpi0: wakeup devices
"BCM2849" at acpi0 not configured
"BCM2835" at acpi0 not configured
"BCM2854" at acpi0 not configured
"ACPI0004" at acpi0 not configured
xhci0 at acpi0 XHC0 addr 0x600000000/0x1000 irq 175, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Generic xHCI root hub" rev 3.00/1.00 
addr 1
"ACPI0007" at acpi0 not configured
"ACPI0007" at acpi0 not configured
"ACPI0007" at acpi0 not configured
"ACPI0007" at acpi0 not configured
"ACPI0004" at acpi0 not configured
"BCM2848" at acpi0 not configured
"BCM2850" at acpi0 not configured
"BCM2856" at acpi0 not configured
"BCM2845" at acpi0 not configured
"BCM2841" at acpi0 not configured
"BCM2841" at acpi0 not configured
"BCM2838" at acpi0 not configured
"BCM2839" at acpi0 not configured
"BCM2844" at acpi0 not configured
pluart0 at acpi0 URT0 addr 0xfe201000/0x1000 irq 153: console
"BCM2836" at acpi0 not configured
"BCM2EA6" at acpi0 not configured
"MSFT8000" at acpi0 not configured
"BCM2847" at acpi0 not configured
"BCM2855" at acpi0 not configured
bse0 at acpi0 ETH0 addr 0xfd580000/0x10000 irq 189: address dc:a6:32:08:a5:51
brgphy0 at bse0 phy 1: BCM54210E 10/100/1000baseT PHY, rev. 2
"PNP0C06" at acpi0 not configured
acpitz at acpi0 not configured
uhub1 at uhub0 port 1 configuration 1 interface 0 "VIA Labs USB2.0 Hub" rev 
2.10/4.21 addr 2
umass0 at uhub0 port 3 configuration 1 interface 0 "TOSHIBA External USB 3.0" 
rev 3.00/1.04 addr 3
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <TO Exter, nal USB 3.0, 0104> 
serial.0080a001015033100081
sd0: 114473MB, 512 bytes/sector, 234441648 sectors
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on sd0a (2f00781d830bfa51.a) swap on sd0b dump on sd0b

usbdevs:
Controller /dev/usb0:
addr 01: 0000:0000 Generic, xHCI root hub
         super speed, self powered, config 1, rev 1.00
         driver: uhub0
addr 02: 2109:3431 VIA Labs, USB2.0 Hub
         high speed, self powered, config 1, rev 4.21
         driver: uhub1
addr 03: 0080:a001 TOSHIBA, External USB 3.0
         super speed, self powered, config 1, rev 1.04, iSerial 2015033100081
         driver: umass0

Reply via email to