https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70336
--- Comment #10 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #8) > Here -Wconversion will warn for many casesm even in 4.9, eventhough one > could argue that say in the f4 case nothing is lost during conversion, or There is an explicit cast, so this case is exactly equivalent to: unsigned char foo (unsigned char x, unsigned char y) { x = x | y; return x; } This seems to me the same case as PR40752, and I would be happy not warning about those and Ian agreed with me, thus I proposed a patch to that effect. > Which is why I've been talking about VRP, > when we start adding further and further cases where the implicit > conversions can't alter the values, we'll reimplement big part of VRP in the > FEs. And this has nothing to do with not really delayed folding (even when > both C and C++ FEs now actually delay folding to some extents), to avoid the > "false positives" from -Wconversion you then want more folding rather than > less folding. Of course, more intelligent static analysis (CCP, VRP, IPA) in the FEs would be very useful, specially for other warnings such as -Wsign-compare. Clang is doing some form of CCP and callgraph analysis to improve diagnostics and it is still faster than GCC FEs. But from reading the list of -Wconversion bugs in bugzilla, this is not what people complain about. They complain about explicit casts being ignored, about not being able to silence warnings for bit-fields and noisy warnings about implicit integral promotions with operands of the same type, where the result is converted back to the same type again. None of those need VRP to be fixed, AFAICT. In most cases, one wants enough analysis to see through implicit casts. This is what shorten_compare et al. are doing. However, the fact that they are optimisations and not analysis make them clumsy to use by -Wconversion and they do not make distinctions between implicit vs. explicit casts, which is very important for -Wconversion.