[PATCH] D124349: [analyzer] Get direct binding for specific punned case

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 00:11:56 PDT 2022


steakhal accepted this revision.
steakhal added a comment.
This revision is now accepted and ready to land.

Looks good.
Wait for an other accept.



================
Comment at: clang/test/Analysis/array-struct-region.c:362-366
+int array_struct_bitfield_1() {
+  BITFIELD_CAST ff = {0};
+  BITFIELD_CAST *pff = &ff;
+  return *((int *)pff + 1);
+}
----------------
```lang=c
void array_struct_bitfield_1() {
  BITFIELD_CAST ff = {0};
  BITFIELD_CAST *pff = &ff;
  clang_analyzer_eval(*((int *)pff + 1) == 0); // expected-warning{{TRUE}}
  ff.b[0] = 3;
  clang_analyzer_eval(*((int *)pff + 1) == 3); // expected-warning{{TRUE}}
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124349



More information about the cfe-commits mailing list