Re: Please revert b2e843161d

Renato Botelho <[email protected]> Wed, 24 Jun 2026 16:52:06 -0300
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
CC'ing Andrew, who is the commit author

On 24/06/26 15:58, Steve Kargl wrote:
> Can someone with commit access please revert b2e843161dc3b?
> 
>     git log -r b2e843161dc3b79777e873183447c92ed9c3703a
>     Author: Andrew Turner <[email protected]>
>     Date:   Tue Nov 2 11:31:17 2021 +0000
> 
>     Use a builtin where possible in msun
> 
> 
> If one has a libm built with, e.g., -DUSE_BUILTIN_FMAF,
> and then tries to debug code that uses fmaf() where the
> compiler options include -fno-builtin, a segfault
> occurs.  I suggest purging all of the recent additions
> of USE_BUILTIN_*.  These are simply not needed as a compiler
> will use a builtin (if available) instead of a function from
> libm.
> 
> % cat t5.c
> #include <math.h>
> #include <stdio.h>
> 
> int
> main(void)
> {
>     float x;
>     x = fmaf(0.9474001f, 4.639901e-7f, -0.24325085f);
>     printf("%la\n", x);
>     return (0);
> }
> 
> % cc -o z -fno-builtin -g t5.c -lm && ./z
> Segmentation fault (core dumped)
> 
> % gdb151 ./z
> (gdb) run
> Starting program: /home/kargl/tmp/z
> 
> Program received signal SIGSEGV, Segmentation fault.
> Invalid permissions for mapped object.
> 0x0000000000201694 in fmaf ()
> 
> PS: t5.c reveals a bug in the software implementation of s_fmaf.c
> 

-- 
Renato Botelho