GNU bug report logs - #25663
verify macro in system.h incorrectly expects 8 byte long for 64-bit builds on Windows/Visual Studio

Previous Next

Package: diffutils;

Reported by: Kees Dekker <Kees.Dekker <at> infor.com>

Date: Thu, 9 Feb 2017 13:17:01 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kees Dekker <Kees.Dekker <at> infor.com>
To: "bug-diffutils <at> gnu.org" <bug-diffutils <at> gnu.org>
Subject: verify macro in system.h incorrectly expects 8 byte long for 64-bit
 builds on Windows/Visual Studio
Date: Thu, 9 Feb 2017 13:15:43 +0000
[Message part 1 (text/plain, inline)]
Hi,

The verify macro in system.h:137 (diffutils3.5) fails on Windows.
This line contains the following code:

verify (sizeof (lin) <= sizeof (long int));

Because of a long on Windows remains 32-bit (for Visual Studio), even in 64-bit mode, this compile time assert fails. It is only for *NIX that a long sizes identical to the bit-ness of the build, similar to pointers.
For an integer type that properly sizes with pointers, you need to use intptr_t. See also https://msdn.microsoft.com/nl-nl/library/s3f49ktz.aspx.

I'm not sure how gcc behaves on Windows, but event then intptr_t is probably the better type to use.

If Visual Studio is used, then the _MSCVER macro is set, see also https://msdn.microsoft.com/en-us/library/b0084kay.aspx.

Can you please fix this?

Regards,
Kees
[Message part 2 (text/html, inline)]

This bug report was last modified 8 years and 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.