* lib/xnanosleep.c (xnanosleep): Declare a temporary to be "volatile",
so that gcc-4.3.0 doesn't optimize away this test for overflow.
Signed-off-by: Jim Meyering <meyering@redhat.com>
+2007-10-07 Jim Meyering <meyering@redhat.com>
+
+ Make xnanosleep's integer overflow test more robust.
+ * lib/xnanosleep.c (xnanosleep): Declare a temporary to be "volatile",
+ so that gcc-4.3.0 doesn't optimize away this test for overflow.
+
2007-10-07 Bruno Haible <bruno@clisp.org>
* doc/gnulib-intro.texi (Copyright): Update the meaning of the license
/* Normalize the interval length. nanosleep requires this. */
if (BILLION <= ts_sleep.tv_nsec)
{
- time_t t = ts_sleep.tv_sec + 1;
+ /* Declare "volatile" so that gcc-4.3.0 doesn't optimize away
+ the overflow test. */
+ volatile time_t t = ts_sleep.tv_sec + 1;
/* Detect integer overflow. */
overflow |= (t < ts_sleep.tv_sec);