qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] target-i386: Use 1UL for bit shift


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 1/2] target-i386: Use 1UL for bit shift
Date: Thu, 1 Oct 2015 10:24:34 +0100

On 30 September 2015 at 21:24, Richard Henderson <address@hidden> wrote:
> On 09/30/2015 11:27 PM, Paolo Bonzini wrote:
>> ps: Ego ceterum censeo that these warnings are useless and uglify the
>> code unnecessarily.  But it looks like I'm in a minority so the patch is
>> okay.

> I totally agree.  There are no ones-compliment machines anymore, and so the
> whole point of that "undefined" in the C standard is moot.  Let's all accept
> that shifts of signed quantities do exactly what we expect.

I'd rather not do that without a documented statement from both
clang and gcc teams that they won't use this UB to do optimizations
that might break programs relying on it. History suggests they
will happily do so if it improves a benchmark at all.

Until the toolchain implementers and the C standards bodies define
"friendly C" for us, we're stuck with the language we have.

> Without looking, I don't suppose either compiler has a switch to disable
> just the shift part of ubsan?

Not without turning off other shift checks which we would want to
retain (like shifts greater than the bitwidth), I think.

thanks
-- PMM



reply via email to

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