This is the mail archive of the
mailing list for the GCC project.
- From: Jeremy Sanders <jss at ast dot cam dot ac dot uk>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 7 Aug 2002 19:14:10 +0100 (BST)
- Subject: Extra warning
gcc-3.1 doesn't seem to warn for the following code (even with
-Wconversion -W -Wall).
a = 10;
c = -10 - a;
Which makes c 4294967276.00 rather than -20. It also doesn't warn for:
a = 10;
b = -10;
c = b - a;
(which of course would be harder to warn for).
Am I missing the appropriate warning option? Would it be sensible/possible
to warn for the promotion of obvious negative integers to unsigned?
Perhaps int-unsigned should have a warning. (int+unsigned usually works if
int is -ve, but probably not according to the standard!).
Jeremy Sanders <email@example.com> http://www-xray.ast.cam.ac.uk/~jss/
X-Ray Group, Institute of Astronomy, University of Cambridge, UK.
Public Key Server PGP Key ID: E1AAE053