[PATCH] D84736: [analyzer] Handle pointer difference of ElementRegion and SymbolicRegion

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 18 10:12:17 PDT 2020


steakhal added inline comments.


================
Comment at: clang/test/Analysis/pointer-arithmetic.c:88
+  clang_analyzer_dump_int(p - pn);       // expected-warning-re {{0 - (reg_${{[0-9]+}}<int n>)}}
+  clang_analyzer_dump_int((p + 1) - q);  // expected-warning {{Unknown}} // FIXME: Might point to the same region, we should hold the expression 'p+1+q' instead.
+  clang_analyzer_dump_int((p + 1) - p);  // expected-warning {{1 S32b}}
----------------
The suggested expression should be `p+1-q`.


================
Comment at: clang/test/Analysis/pointer-arithmetic.c:100
+  clang_analyzer_dump_int(pn - p);       // expected-warning-re {{reg_${{[0-9]+}}<int n>}}
+  clang_analyzer_dump_int(q - (p + 1));  // expected-warning {{Unknown}} // FIXME: Might point to the same region, we should hold the expression 'p+1+q' instead.
+  clang_analyzer_dump_int(p - (p + 1));  // expected-warning {{-1 S32b}}
----------------
The suggested expression should be `q-p+1`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84736



More information about the cfe-commits mailing list