Re: Having fun with the following C code (UB)
Vincent Lefevre wrote:
[...]
> int foo (int d)
> {
> int m;
> m = d * 64;
> return m;
> }
[...]
> while the cause of a potential bug would be the same. For consistency,
> GCC should have warned for the first code too.
No, there is no optimisation in that case, so there is no warning. It only
warns when it uses the knowledge that "(signed) integer overflow isn't
possible" to optimise away some redundant code.
Cheers,
--
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net
Reply to: