https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111726
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I think the abs is not needed for some of the lgamma calls, as the argument is guaranteed to be non-negative. Unfortunately, that's not the case for all of them. lgamma_r, lgammaf_r and lgammal_r are present in glibc, musl, newlib, Solaris, FreeBSD, NetBSD at least. Not present in AIX or mingw-w64. Not present in darwin unless you compile with _REENTRANT, which makes it unusable for libstdc++ (we need it to be declared by <math.h> unconditionally).