[Bug 288850] [libm] avoid left shift of signed integer entity in ilogbf(), fmodf(), and remquof().

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 14 Aug 2025 18:40:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288850

--- Comment #1 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=c58c77246f88da87f309e8c449e98195d43e2c76

commit c58c77246f88da87f309e8c449e98195d43e2c76
Author:     Steve Kargl <kargl@FreeBSD.org>
AuthorDate: 2025-08-14 18:38:41 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-08-14 18:38:41 +0000

    [libm] Avoid left shift of signed integer entities

    Follow-up commit d180086e6eae by fixing the left shift of signed integer
    entities through the use of a helper function. Specific per file changes
    are:

    * lib/msun/src/e_fmodf.c:
    * lib/msun/src/s_remquof.c:
      . Eliminate now unused variable 'i'.
      . Sort declaration statement.
      . Use subnormal_ilogbf() to avoid left shift of signed integer.

    * lib/msun/src/math_private.h b/lib/msun/src/math_private.h:
      . Implement subnormal_ilogbf() to extract an exponent of a subnormal
        float.  This avoids left shifts of signed integers.
      . Update nearby comment.

    * lib/msun/src/s_ilogbf.c
      . Fix declaration of the function statement in accordance with style(9).
      . Use subnormal_ilogbf() to avoid left shift of signed integer.

    PR:             288850
    MFC after:      1 week

 lib/msun/src/e_fmodf.c      | 16 +++++++++-------
 lib/msun/src/math_private.h | 16 +++++++++++++++-
 lib/msun/src/s_ilogbf.c     |  5 +++--
 lib/msun/src/s_remquof.c    | 16 +++++++++-------
 4 files changed, 36 insertions(+), 17 deletions(-)

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