GNU bug report logs - #7928
mktime test in configure: UB resulting in infinite loop

Previous Next

Package: coreutils;

Reported by: Rich Felker <dalias <at> aerifal.cx>

Date: Thu, 27 Jan 2011 06:44:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bruno Haible <bruno <at> clisp.org>
To: Rich Felker <dalias <at> aerifal.cx>
Cc: bug-gnulib <at> gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>, 7928 <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>
Subject: bug#7928: mktime test in configure: UB resulting in infinite loop
Date: Fri, 28 Jan 2011 18:57:22 +0100
Rich Felker wrote:
> Testing which of the three allowable signed integer
> representations is used is easy: compare ~(t)1 against and -(t)1 and
> -(t)2.

Testing which of the three signed integer representations is in use
is not even needed: Your formula
  ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)
yields the correct result in all three cases.

Bruno




This bug report was last modified 14 years and 177 days ago.

Previous Next


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