[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] Remove left shifts of negative signed integer
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-trivial] [PATCH] Remove left shifts of negative signed integers |
Date: |
Thu, 30 Jun 2016 16:32:59 -0400 (EDT) |
> > GCC correctly puts this warning under -Wextra, and promises not to ever
> > make use of this facet of undefined behavior. The only correct patch
> > is the one that disables the warning for clang, and possibly adds
> > -fwrapv. In GCC, -fwrapv correctly silences ubsan's left-shift
> > and signed-overflow warnings. In Clang, this is reported at
> > https://llvm.org/bugs/show_bug.cgi?id=25552. It's a heavy hammer
> > but it's the safest options as compiler evolve.
>
> Where /exactly/ do you propose we canonicalize the clang invocation you
> would like to support?
In configure where we look for other warning flags. Add -fwrapv and
-Wno-shift-negative-value so that they're enabled if the compilers
supports them.
Paolo