Compiler Warnings

Andy Heninger aheninger at google.com
Tue Apr 12 20:53:29 UTC 2011


Here are some compiler warnings that it would probably be good to be rid of.
 The compiler is optimizing away intended overflow tests in some cases.
 Results of integer operations are officially undefined when overflow
occurs, so the compiler is within its rights in making this kind of
assumption.

$ gcc -Wall -O3 -c *.c

localtime.c: In function ‘timesub’:
localtime.c:1541: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
localtime.c:1545: warning: assuming signed overflow does not occur when
assuming that (X - c) > X is always false
localtime.c: In function ‘T.144’:
localtime.c:1727: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
localtime.c:1738: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
localtime.c:1748: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
localtime.c:1752: warning: assuming signed overflow does not occur when
assuming that (X - c) > X is always false
localtime.c:1768: warning: assuming signed overflow does not occur when
assuming that (X - c) > X is always false

zdump.c: In function ‘main’:
zdump.c:442: warning: assuming signed overflow does not occur when assuming
that (X - c) > X is always false

$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

  -- Andy Heninger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm.icann.org/pipermail/tz/attachments/20110412/c16bbcbb/attachment-0001.html 


More information about the tz mailing list