This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/34389] -Wconversion produces wrong warning



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]