[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 29 13:03:45 PST 2021


xazax.hun added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:58
+      : From(From), To(To), Ctx(Ctx) {}
+  bool canAccessImpl() {
+    return isSame() || isCharOrByte() || isOppositeSign();
----------------
I'd love to see some detailed descriptions of the strict aliasing rule, what parts are we checking for and what parts we don't. E.g. it would be nice to document the differences between C and C++ aliasing rules. I do remember something about prefixes, i.e.: it would be well defined to access something with the dynamic type `struct { int x, y; };` and read `struct{ int x; };` from it. Does that not apply to C++?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114718



More information about the cfe-commits mailing list