[PATCH] D85256: Add -Wtautological-value-range-compare warning.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 4 17:33:49 PDT 2020


rsmith added a comment.

In D85256#2194892 <https://reviews.llvm.org/D85256#2194892>, @xbolva00 wrote:

> Could this solve https://bugs.llvm.org/show_bug.cgi?id=40921 ?

Not directly; `GetExprRange` in `SemaChecking` apparently intentionally treats casts as producing an arbitrary value of the destination type:

  // I think we only want to look through implicit casts here; if the
  // user has an explicit widening cast, we should treat the value as
  // being of the new, wider type.

I'm not entirely convinced that what the comment describes is the best approach. If we revisited that choice then, with this patch, we would indeed diagnose the PR40921 case. But I think that and this are separate changes and I'd prefer not to combine them.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85256/new/

https://reviews.llvm.org/D85256



More information about the cfe-commits mailing list