On Tue, Jul 14, 2015 at 10:30:06PM +0100, Richard Sandiford wrote: > Marek Polacek <pola...@redhat.com> writes: > > + /* Don't warn for e.g. > > + HOST_WIDE_INT n; > > + ... > > + if (n == (long) n) ... > > + */ > > + if ((CONVERT_EXPR_P (lhs) || TREE_CODE (lhs) == NON_LVALUE_EXPR) > > + ^ (CONVERT_EXPR_P (rhs) || TREE_CODE (rhs) == NON_LVALUE_EXPR)) > > + return; > > I might be misreading it, sorry, but it looks like the XOR means that > we'd still warn for: > > if ((HOST_WIDE_INT) n == (long) n) ... > > in cases where HOST_WIDE_INT and long have the same precision.
Yes, that's true. Maybe we want to warn in that case as well, I didn't know. If we do, just changing ^ into || would probably help. It's somewhat hazy to me what to do in this case. Marek