Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-09 Thread Markus Armbruster
Peter Maydell writes: > On 6 February 2015 at 17:37, Eric Blake wrote: >> On 02/06/2015 07:34 AM, Peter Maydell wrote: >> HACKING already implies we assume sane 2's complement behavior of shifts >> (maybe it's worth another line for this particular case of shifting into >> the signed bit of a si

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Peter Maydell
On 6 February 2015 at 17:37, Eric Blake wrote: > On 02/06/2015 07:34 AM, Peter Maydell wrote: > HACKING already implies we assume sane 2's complement behavior of shifts > (maybe it's worth another line for this particular case of shifting into > the signed bit of a signed result, and figuring out

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Eric Blake
On 02/06/2015 07:34 AM, Peter Maydell wrote: > This patchset fixes a collection of warnings emitted by the clang > undefined behaviour sanitizer in the course of booting an AArch64 > Linux guest to a shell prompt. These are all various kinds of bad > shift (shifting into the sign bit, left shifting

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Richard Henderson
On 02/06/2015 08:43 AM, Peter Maydell wrote: > On 6 February 2015 at 16:20, Richard Henderson wrote: >> It should be enough to simply add the unsigned suffix to the integers as they >> are, forcing the underlying type to be unsigned. > > I can't see anything in the C99 spec that justifies this >

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Peter Maydell
On 6 February 2015 at 16:20, Richard Henderson wrote: > It should be enough to simply add the unsigned suffix to the integers as they > are, forcing the underlying type to be unsigned. I can't see anything in the C99 spec that justifies this as a fix... In fact, 6.7.2.2 para 3 says "The identifie

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Richard Henderson
On 02/06/2015 06:34 AM, Peter Maydell wrote: > I can't see any nice way of avoiding this. Possible nasty ways: > > (1) Drop the enum and just use old-fashioned > #define EC_AA64_BKPT 0x3cU > since then we can force them to be unsigned > (2) Cast the constant to unsigned at point of use > (3) Keep

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Richard Henderson
On 02/06/2015 07:57 AM, Greg Bellows wrote: > Similar to the #define approach, but possibly with the benefits of the enum. > What if you declare each enum separately as const unsigned int? This is not c++. That won't do what you want. r~

Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Greg Bellows
On Fri, Feb 6, 2015 at 8:34 AM, Peter Maydell wrote: > This patchset fixes a collection of warnings emitted by the clang > undefined behaviour sanitizer in the course of booting an AArch64 > Linux guest to a shell prompt. These are all various kinds of bad > shift (shifting into the sign bit, lef

[Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings

2015-02-06 Thread Peter Maydell
This patchset fixes a collection of warnings emitted by the clang undefined behaviour sanitizer in the course of booting an AArch64 Linux guest to a shell prompt. These are all various kinds of bad shift (shifting into the sign bit, left shifting negative values, shifting by more than the size of t