RE: [PATCH next v4 0/5] minmax: Relax type checks in min() and max().

From: David Laight
Date: Tue Jan 09 2024 - 04:42:59 EST


From: Linus Torvalds
> Sent: 08 January 2024 18:19
...
> That said, I'm sure this thing exists to a smaller degree elsewhere. I
> wonder if we could simplify our min/max type tests..

Could the type-check be moved into one of the debug builds?
That would give the coverage without slowing down all builds?

Adding -Wsign-compare is a PITA until gcc adds value tracking
to it, not just a type check.
Otherwise it bleats about:
int rval = fn();
if (rval < 0)
return rval;
if (rval > unsigned_value)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)