On Fri, 2016-04-22 at 15:37 -0600, Jerry James wrote:
On Fri, Apr 22, 2016 at 2:54 PM, Adam Williamson
<adamwill(a)fedoraproject.org> wrote:
> Upstream bug:
>
>
https://github.com/vmware/open-vm-tools/issues/67
>
> the relevant code is here:
>
>
https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/lib/inc...
>
> GCC 6 does not like this:
>
> #define VMW_BIT_MASK(shift) (((1 << (shift - 1)) << 1) - 1)
>
> it produces errors:
>
> /builddir/build/BUILD/open-vm-tools-10.0.0-3000743/lib/include/x86cpuid.h:912:51:
error: result of '-2147483648 << 1' requires 33 bits to represent, but
'int' only has 32 bits [-Werror=shift-overflow=]
> #define VMW_BIT_MASK(shift) (((1 << (shift - 1)) << 1) - 1)
Change the definition of VMW_BIT_MASK in lib/include/x86cpuid.h to this:
#define VMW_BIT_MASK(shift) ((int)(long)(((1UL << (shift - 1)) << 1) - 1))
The (int)(long) is so that gcc doesn't complain about reducing the bit
width AND changing signedness in a single typecast. They really ought
to be using unsigned integers for all of this anyway, but that's an
issue for upstream to sort out.
Well, my personal preference for things like this is to send a patch
upstream as a PR and pull that exact patch into the package with a
comment link to the PR. But if that's substantially harder, no problem.
Thanks for the suggestion!
--
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net