[PATCH] D38971: Enhance libsanitizer support for invalid-pointer-pair.

Martin Liška via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 02:39:55 PST 2017


marxin marked an inline comment as done.
marxin added inline comments.


================
Comment at: lib/asan/asan_report.cc:332
+  if (GetGlobalAddressInformation(left, 0, &gdesc1))
+    return GetGlobalAddressInformation(right - 1, 0, &gdesc2) == 0 ||
+        !gdesc1.PointsInsideTheSameVariable(gdesc2);
----------------
alekseyshl wrote:
> I wonder why "right - 1"?
Because it's possible to have a valid pointer comparison of a pointer that points right after a valid location.
In case of global variables, for a pointer pointing right after a variable, I want to have it listed in GlobalAddressDescription.
I added test-case for that:

+  bar(&global[0], &global[10000]);


https://reviews.llvm.org/D38971





More information about the llvm-commits mailing list