[PATCH] Remove __isinf uses that rely on signed return value
Wilco Dijkstra
wdijkstr@arm.com
Wed Jun 3 11:55:00 GMT 2015
> Joseph Myers wrote:
> On Tue, 2 Jun 2015, Wilco Dijkstra wrote:
>
> > The printf code contains a few uses of __isinf where the sign is used -
> > replace these with separate isinf and signbit.
>
> Why? Isn't the point of glibc's isinf returning a signed value that you
> can do such combined operations?
We discussed this a while back (and I thought it was agreed on going forward
like this) - to recap, it is not required by any standard (so no standard
compliant software may rely on this GLIBC specific behaviour), and is
actually incompatible with C++ which requires a boolean to be returned.
So the idea is to only support the old behaviour in GNUC mode for backwards
compatibility, but not in C99/C++.
It would be possible to introduce a new macro isinf_sign if someone can make
the argument it is a good interface. I don't see how it could be as getting
the sign is just a single compare or shift once you've transferred the FP
value to the integer side - in other words isinf_sign (x) will be slower than
using isinf (x) plus signbit (x)...
> I'd also really recommend separating safe cleanups that don't change the
> stripped installed shared libraries at all (other than assertion line
> numbers), such as moving to use the type-generic macros internally, from
> any other changes that might affect the installed binaries. And when
> something shouldn't change the (stripped) installed binaries, verify that
> it doesn't, and state the platform on which you did such verification.
I have a separate patch with all the __isxxx macros renamed across GLIBC, so
I'll add the __isnan cases in printf too. I'll check in when I've confirmed
there are no diffs.
Wilco
More information about the Libc-alpha
mailing list