bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#7928: mktime test in configure: UB resulting in infinite loop


From: Paul Eggert
Subject: Re: bug#7928: mktime test in configure: UB resulting in infinite loop
Date: Thu, 27 Jan 2011 23:42:25 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]