Correct min_of_type handling of _Float128.
commitd08cdabdd096325a3296713c87672f213b05f5c6
authorJoseph Myers <joseph@codesourcery.com>
Thu, 22 Jun 2017 22:46:27 +0000 (22 22:46 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 22 Jun 2017 22:46:27 +0000 (22 22:46 +0000)
tree8bc7b48f8a43c030f8f1b9e7bfa82cefb23c139e
parent46d2e49c49165c09d8ebf555e56d74d063102342
Correct min_of_type handling of _Float128.

The math_private.h macro min_of_type has broken _Float128 handling:
instead of passing its type argument to the key __EXPR_FLT128 macro,
it passes x, which is not a macro argument but whatever variable
called x happens to be visible in the calling function.  If that
variable has the wrong type, the wrong one of long double and
_Float128 can get chosen.  In particular, this applies to some
_Complex long double functions (where x happens to have type _Complex
long double, resulting in min_of_type returning a _Float128 value when
it should return a long double value).  For some reason, this only
caused test failures for me on x86_64 with GCC 6 but not GCC 7 (I
suspect it triggers known bugs in conversions from x86 long double to
_Float128 that are present in GCC 6's soft-fp).

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/generic/math_private.h (__EXPR_FLT128): Do not apply
typeof to argument passed to __builtin_types_compatible_p.
(min_of_type): Pass type argument, not x, to __EXPR_FLT128.
ChangeLog
sysdeps/generic/math_private.h