[PATCH 0/8] Fix UB in math implementations

Carlos O'Donell carlos@redhat.com
Tue Apr 29 12:50:04 GMT 2025


On 4/25/25 4:54 PM, Adhemerval Zanella wrote:
>  From a recent experiment to build glibc with -fsanitize=undefined [1],
> I found that some float implementation triggers UB. The issues from
> this patchset were already fixed in the upstream projects.

Looks good! Thanks for fixing the UB issues.

I went through them all just to have a look at the state of the implementation
versus CORE-MATH and the fixes that Paul was making upstream.

Thanks for doing this kind of technical debt reduction, eventually it bites
us, as would lagging too much behind CORE-MATH.

> [1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/ubsan-undef
> 
> Adhemerval Zanella (8):
>    math: Fix UB on atanhf
>    math: Fix UB on coshf
>    math: Fix UB on logf
>    math: Fix UB on sinhf
>    math: Fix UB on cbrtf
>    math: Fix UB on cospif
>    math: Fix UB on erfcf
>    math: Fix UB on sinpif
> 
>   sysdeps/ieee754/flt-32/e_atanhf.c | 4 ++--
>   sysdeps/ieee754/flt-32/e_coshf.c  | 6 +++---
>   sysdeps/ieee754/flt-32/e_logf.c   | 2 +-
>   sysdeps/ieee754/flt-32/e_sinhf.c  | 6 +++---
>   sysdeps/ieee754/flt-32/s_cbrtf.c  | 6 +++---
>   sysdeps/ieee754/flt-32/s_cospif.c | 6 +++---
>   sysdeps/ieee754/flt-32/s_erfcf.c  | 4 ++--
>   sysdeps/ieee754/flt-32/s_sinpif.c | 8 ++++----
>   8 files changed, 21 insertions(+), 21 deletions(-)
> 


-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list