qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 00/40] ppc patch queue 2015-06-03


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PULL 00/40] ppc patch queue 2015-06-03
Date: Fri, 05 Jun 2015 17:02:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0


On 05/06/2015 16:40, Peter Maydell wrote:
> > Speaking in general, I find that this makes code worse.  If you're using
> > ~0 you probably want the value to extend with infinite ones.
> >
> > Using ~0u instead of ~0ull may cause problems down the line, and  ~0ul
> > is even worse because it is not 64-bit safe.
>
> I agree that C's semantics are terrible here (ideally
> left shift of negative values should Just Work in the 2s
> complement style, and right shift of negative values should
> be an arithmetic shift). Unfortunately we're stuck with
> the standard, which says this is undefined behaviour :-(

But this is not something that C compiler writers can reasonably change.

Can someone add a checkpatch rule that forbids shifting left U or UL
constants (i.e. only ULL)?  That would alleviate my concerns with these
ubsan warnings.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]