[Bug c/34389] -Wconversion produces wrong warning

manu at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Feb 15 16:54:00 GMT 2008



------- Comment #7 from manu at gcc dot gnu dot org  2008-02-15 16:53 -------
So fold_unary is transforming (T)(x & c) into (T)x & (T)c. Which is exactly the
opposite transformation that build_binary_op just performed! Weird...

So I see two options:

* Either teach fold_unary to avoid this particular transformation in this
particular case.

* Hack conversion_warning to realize that (short)((int)x & c) is the same as
(short)(x & c) if x is signed int and c fits in a signed int. Which will be
undoing the transformation once more (fourth? fifth time?). And I am not even
sure how to do this.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34389



More information about the Gcc-bugs mailing list