[PATCH] D124349: [analyzer] Get direct binding for specific punned case
Vince Bridgers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 25 01:30:23 PDT 2022
vabridgers added inline comments.
================
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);
+}
----------------
steakhal wrote:
> ```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}}
> }
> ```
Good suggestion, thanks. I'll add this and wait for another accept.
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