Re: Help needed to fix open-vm-tools for GCC 6 to unblock Rawhide Workstation

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

 



On Fri, Apr 22, 2016 at 2:54 PM, Adam Williamson
<adamwill@xxxxxxxxxxxxxxxxx> 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/include/x86cpuid.h#L899-L932
>
> 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.
-- 
Jerry James
http://www.jamezone.org/
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux