[PATCH] D60243: [LSan][AArch64] Speed-up leak and address sanitizers on AArch64 for 47-bit VMA

Brian Rzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 08:45:48 PDT 2019


brzycki added inline comments.


================
Comment at: compiler-rt/lib/lsan/lsan_allocator.cc:43
+  // 64-bit allocator.
+  if (GetMaxVirtualAddress() < (((uptr)1 << 48) - 1))
+    UseAllocator32 = true;
----------------
Compiling on x86_64 causes a shift-count-overflow warning to be emitted:
```
/tmp/tmp.rRhin33V2X/src/llvm/projects/compiler-rt/lib/lsan/lsan_allocator.cc:43:42: warning: shift count >= width of type [-Wshift-count-overflow]
  if (GetMaxVirtualAddress() < (((uptr)1 << 48) - 1))
                                         ^  ~~
1 warning generated.
```

Changing the comparison to the following line removes the warning:
```
if (GetMaxVirtualAddress() < (uptr)0xffffffffffffUL)
```

It's a bit less readable but it doesn't have the warning or the potential to overflow.


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

https://reviews.llvm.org/D60243





More information about the llvm-commits mailing list