[PATCH] D63423: [Diagnostics] Diagnose misused xor as pow

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 11:06:35 PDT 2019


jfb added inline comments.


================
Comment at: test/Sema/warn-xor-as-pow.c:45
+  // expected-note at -1 {{replace expression with '(2) ^ 32' to silence this warning}}
+  res = 2 ^ 64; // expected-warning {{result of '2 ^ 64' is 66; maybe you mean '1<<64', but shift count >= width of type}}
+  // expected-note at -1 {{replace expression with '(2) ^ 64' to silence this warning}}
----------------
xbolva00 wrote:
> jfb wrote:
> > This one hits a ceiling, we can't really suggest anything for this value IMO. Maybe we need to see if the user is doing `2^64 - 1`? In that case we can offer a suggestion.
> Since this requires changes in other parts of code to catch 2^64 - 1, maybe we can leave it as a follow-up patch?
Sure.


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

https://reviews.llvm.org/D63423





More information about the cfe-commits mailing list