[PATCH] D144565: dwp check overflow

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 10:42:16 PDT 2023


ayermolo added inline comments.


================
Comment at: llvm/lib/DWP/DWP.cpp:237
+    uint32_t OldOffset = TypesOffset;
+    static_assert(sizeof(OldOffset == TypesOffset));
     TypesOffset += C.getLength();
----------------
zhuna8616 wrote:
> ayermolo wrote:
> > I don't think this is the same as sizeof(OldOffset) == sizeof(TypesOffset)
> Err... typos... My bad
To be clear I think it's still a good idea to have the static_assert since you are relying on both being same type in your check.
static_assert(sizeof(OldOffset) == sizeof(TypesOffset)));


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144565



More information about the llvm-commits mailing list