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

From: Bruno Haible <[email-masked]>
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