[Midnightbsd-cvs] [MidnightBSD/src] e1fd91: [libm] Fix undefined behavior of a left shifted of...

Lucas Holt noreply at github.com
Tue Dec 16 17:57:49 EST 2025


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/src
  Commit: e1fd91d39fae16db3c24d49921e6c65b2e5e3cbf
      https://github.com/MidnightBSD/src/commit/e1fd91d39fae16db3c24d49921e6c65b2e5e3cbf
  Author: Steve Kargl <kargl at FreeBSD.org>
  Date:   2025-12-16 (Tue, 16 Dec 2025)

  Changed paths:
    M lib/msun/src/e_fmod.c
    M lib/msun/src/math_private.h
    M lib/msun/src/s_ilogb.c
    M lib/msun/src/s_remquo.c

  Log Message:
  -----------
  [libm] Fix undefined behavior of a left shifted of a signed integer

The patch fixes a few instances of left shifts on
signed integer entities.  A 'static inline' helper function
'subnormal_ilogb()' has been added to math_private.h.  This
function is then used e_fmod.c, s_ilogb(), and s_remquo.c.

The change in s_remquo.c has only been compile tested.

The change to e_fmod.c has been test on over 3 billion pairs
of subnormal numbers where testing included x > y and x < y
pairs.  The test compared the output from fmod() with the
output from mpfr_fmod() from MPFR.  There were no difference.

The change to s_ilogb() has had limited testing where its
output was compared against frexp().  In this testing, no
differences in output were detected.

PR:	288778
MFC after:	1 week

(cherry picked from commit d180086e6eae2e152e803ed6cf13775a7c006dc7)



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications


More information about the Midnightbsd-cvs mailing list