[PATCH v2] math/testtgmath2: Fix fabs failure when no long double

Joseph Myers joseph@codesourcery.com
Wed Jan 13 17:52:33 GMT 2021


This patch is OK with the missing hyphen in "test-tgmath2" inserted in the 
summary line.

Notes:

* I think the reason this applies to tests of fabs but not tests of other 
functions is that fabs is declared with the __const__ attribute in 
bits/mathcalls.h, so even with -fno-builtin the compiler can remove 
duplicate calls with the same argument.

* The test itself defines ldouble to double if !(LDBL_MANT_DIG > 
DBL_MANT_DIG) so this issue doesn't actually depend on the compiler doing 
any optimizations related to asm remapping of functions in headers.

* Since tgmath.h, when used with compilers older than GCC 8, doesn't 
guarantee actually calling exactly the function name for the type in 
question, only calling some function aliased to it and getting exactly the 
right return type, the test's remapping of ldouble to double helps it 
produce predictable results rather than needing to deal with dependence on 
compiler versions determining whether the double or long double function 
gets called in some cases.

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list