[Bug 283017] lib/msun/logarithm_test:generic_tests failed on arm64

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 28 Nov 2024 07:35:19 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283017

            Bug ID: 283017
           Summary: lib/msun/logarithm_test:generic_tests failed on arm64
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: h237k77777@gmail.com
                CC: lwhsu@FreeBSD.org

I am currently using FreeBSD 15.0-CURRENT, and the commit ID is
357185a966c10397c971ef23525943ebc47d58d9.

This is some part of stderr output from testing with kyua-test in
logarithm_test:generic_tests:
*** Check failed: /usr/src/lib/msun/tests/logarithm_test.c:110: (0x00000001) !=
fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)):
unexpected exception flags: got 0 not 0x1 for logl(-__builtin_inff())
...
*** Check failed: /usr/src/lib/msun/tests/logarithm_test.c:112: (0x00000001) !=
fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)):
unexpected exception flags: got 0 not 0x1 for logl(-1.0)
...

When using negative numbers as input for the logarithm function (log), an
exception was expected to be raised, but none occurred.

Below is an example program:

#include <stdio.h>
#include <math.h>
#include <fenv.h>

void run_log_test(long double input, long double expected, int expected_except)
{
    feclearexcept(FE_ALL_EXCEPT);
    long double result = logl(input);
    int raised_except = fetestexcept(FE_ALL_EXCEPT);

    printf("Test: log(%.25Lg)\n", input);
    printf("Expected: %.25Lg, Got: %.25Lg\n", expected, result);
    printf("Expected exceptions: 0x%x, Raised exceptions: 0x%x\n\n",
expected_except, raised_except);
}

int main()
{
    // log(-1.0) -> NaN, FE_INVALID
    run_log_test(-1.0L, NAN, FE_INVALID);

    // log(-INFINITY) -> NaN, FE_INVALID
    run_log_test(-INFINITY, NAN, FE_INVALID);

    return 0;
}

Output:

Test: log(-1)
Expected: nan, Got: nan
Expected exceptions: 0x1, Raised exceptions: 0x0

Test: log(-inf)
Expected: nan, Got: nan
Expected exceptions: 0x1, Raised exceptions: 0x0

-- 
You are receiving this mail because:
You are the assignee for the bug.