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

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 2 10:33:01 PDT 2021


hvdijk added a comment.

In D63423#2732199 <https://reviews.llvm.org/D63423#2732199>, @xbolva00 wrote:

> No, we want to preserve warning for 2 ^ MACRO or 10 ^ MACRO.

Perhaps that should warn even if the RHS is in hex form, or is an enumerator constant, or is not even constant at all.

libpng: #if-ed out but just waiting for someone to copy and paste: `for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"}`.

https://github.com/mongodb/mongo/blob/master/src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/mphoc_macros.h:

  #define MPHOC_MAX_CHAR  ((2 ^ (BITS_PER_CHAR - 1)) - 1)
  #define MPHOC_MAX_SHORT ((2 ^ (BITS_PER_SHORT - 1)) - 1)
  #define MPHOC_MAX_INT   ((2 ^ (BITS_PER_INT - 1)) - 1)
  #define MPHOC_MAX_LONG  ((2 ^ (BITS_PER_LONG - 1)) - 1)
  #define MPHOC_MAX_WORD  ((2 ^ (BITS_PER_WORD - 1)) - 1)

(and many more in there)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63423



More information about the llvm-commits mailing list