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: Paul Eggert <eggert <at> cs.ucla.edu>
To: Rich Felker <dalias <at> aerifal.cx>
Cc: 7928 <at> debbugs.gnu.org, bug-gnulib <at> gnu.org, Bruno Haible <bruno <at> clisp.org>, Eric Blake <eblake <at> redhat.com>
Subject: bug#7928: mktime test in configure: UB resulting in infinite loop
Date: Thu, 27 Jan 2011 23:42:25 -0800
On 01/27/2011 02:08 PM, Rich Felker wrote:
> I mean to say that left-shifting a negative value *at all* is
> undefined behavior. I doubt gcc will ever break it, but why not use my
> version of the code that's 100% safe and never invokes undefined
> behavior?

Your version of the code provokes similar undefined behavior
when computing TYPE_MINIMUM, which means that overall it's
no more reliable than what's there now.  An advantage of
the current approach is that there's a clear relationship
between TYPE_MINIMUM and TYPE_MAXIMUM, and this aids understanding.
If it could be done just as clearly by other means, that would
be OK too.




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

Previous Next


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