GNU bug report logs - #24311
[PATCH] maint: accommodate LP64 systems

Previous Next

Package: diffutils;

Reported by: Peter Rosin <peda <at> lysator.liu.se>

Date: Fri, 26 Aug 2016 08:43:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Peter Rosin <peda <at> lysator.liu.se>, 24311 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#24311: [PATCH] maint: accommodate LP64 systems
Date: Fri, 26 Aug 2016 11:42:42 -0700
On 08/26/2016 01:41 AM, Peter Rosin wrote:
> It is wrong to assume that pointers fit in long int.

Not in GNU code. 
<https://www.gnu.org/prep/standards/html_node/CPU-Portability.html says 
that GNU programs should not make any effort to cater to the possibility 
that 'long' will be narrower than ptrdiff_t.

(It should be safe to convert ptrdiff_t to long in an LP64 system, so I 
assume you meant to write "LLP64" in the Subject: line. Also, the values 
in questions are offsets, not pointers, so I assume you meant to write 
"pointer differences" not "pointers" in the above-quoted sentence.)

A problem with the proposed patch is that it uses PRIdPTR, and thus 
won't work on platforms with older C libraries that lack support for 
PRIdPTR. Although this can be worked around with some effort, as a 
general rule we prefer to avoid the effort.

Every POSIX platform is supposed to provide a compilation environment 
where 'long' is no wider than ptrdiff_t, so if you're using a POSIX 
platform you should be able to build diffutils without modifying its 
source code. See:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html





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

Previous Next


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