This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Extra warning
Jeremy Sanders wrote:-
> Hi,
>
> gcc-3.1 doesn't seem to warn for the following code (even with
> -Wconversion -W -Wall).
>
> unsigned a;
> double c;
> a = 10;
> c = -10 - a;
>
> Which makes c 4294967276.00 rather than -20. It also doesn't warn for:
>
> unsigned a;
> int b;
> double c;
> a = 10;
> b = -10;
> c = b - a;
>
> (which of course would be harder to warn for).
If you'd really like this addressed at some time in the future,
please file a PR (gcc.gnu.org/bugs.html). Otherwise it will be
forgotten.
Neil.