Re: [Qemu-devel] [PATCH v2 2/2] hw/openrisc: avoid undefined shift in openrisc_pic_cpu_handler()

2013-08-14 Thread Jia Liu
Hi Xi, On Wed, Aug 14, 2013 at 1:55 PM, Xi Wang wrote: > In C99 signed shift (1 << 31) is undefined behavior, since the result > exceeds INT_MAX. Use 1U instead and move the shift after the check. > > Cc: Jia Liu > Cc: Paolo Bonzini > Signed-off-by: Xi Wang > --- > hw/openrisc/pic_cpu.c | 4

[Qemu-devel] [PATCH v2 2/2] hw/openrisc: avoid undefined shift in openrisc_pic_cpu_handler()

2013-08-13 Thread Xi Wang
In C99 signed shift (1 << 31) is undefined behavior, since the result exceeds INT_MAX. Use 1U instead and move the shift after the check. Cc: Jia Liu Cc: Paolo Bonzini Signed-off-by: Xi Wang --- hw/openrisc/pic_cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/op