Re: [PATCH rdma-rc v1] overflow: Fix -Wtype-limits compilation warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 07, 2019 at 08:14:01AM -0800, Bart Van Assche wrote:
> On Wed, 2019-03-06 at 16:44 +0000, Jason Gunthorpe wrote:
> > On Wed, Mar 06, 2019 at 02:37:17PM +0200, Leon Romanovsky wrote:
> > > diff --git a/include/linux/overflow.h b/include/linux/overflow.h
> > > index 40b48e2133cb..a47fb6046c0a 100644
> > > +++ b/include/linux/overflow.h
> > > @@ -227,10 +227,10 @@
> > >  	typeof(d) _d = d;						\
> > >  	u64 _a_full = _a;						\
> > >  	unsigned int _to_shift =					\
> > > -		_s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;		\
> > > +		(_s == 0 || _s > 0) && _s < 8 * sizeof(*d) ? _s : 0;	\
> >
> > I think this is just trading a tautological compare gcc happens to
> > know about today (_s >= 0) with one it currently doesn't (_s == 0 ||
> > _s > 0)
>
> Since it is uncommon to write (_s >= 0) as (_s == 0 || _s > 0) my hope is
> that the gcc maintainers won't consider it interesting to make gcc report
> a warning about the latter expression.

Thanks Bart,
Once they do such report, we will find a way to overcome it too.
It is unlikely that it will happen in near future.

Thanks

>
> Bart.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux