GNU bug report logs - #9000
patch for higher-resolution time stamps

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Tue, 5 Jul 2011 06:42:02 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 #54 received at 9000 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 9000 <at> debbugs.gnu.org
Subject: Re: bug#9000: patch for higher-resolution time stamps
Date: Sun, 24 Jun 2012 05:57:57 +0300
> Date: Sat, 23 Jun 2012 15:45:26 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: 9000 <at> debbugs.gnu.org
> 
> On 06/23/2012 12:42 PM, Eli Zaretskii wrote:
> > Never mind, I fixed that myself.
> 
> Unfortunately the patch that you installed can break
> Emacs on hosts where time_t is unsigned, because
> it assigns time_t values to intmax_t variables,
> and this does not always work correctly when
> INTMAX_MAX < TIME_T_MAX.

We could use (UINTMAX_MAX / 2) instead, would that work?

> Which version of GCC are you running?

3.4.2

> What is INTMAX_MAX defined to, on your platform?

It is defined to INT64_MAX (i.e., 9223372036854775807LL).  The problem
is that EMACS_SECS returns a time_t, a 32-bit value, whereas
INTMAX_MAX is a 64-bit value.

> Does it work to pacify your old GCC if you
> replace this:
> 
>       intmax_t secs = EMACS_SECS (t);
> 
>       wait_reading_process_output (min (secs, INTMAX_MAX),
>                                    EMACS_NSECS (t), 0, 0, Qnil, NULL, 0);
> 
> with this?
> 
>       intmax_t max = INTMAX_MAX;
> 
>       wait_reading_process_output (min (secs, max),
>                                    EMACS_NSECS (t), 0, 0, Qnil, NULL, 0);

You don't show what is 'secs' in this snippet.  The key to avoiding
the warning is to have both arguments of 'min' be 64-bit values.




This bug report was last modified 12 years and 338 days ago.

Previous Next


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