From 43d241f94bf12ce02bc180957547ddf06a5b3eaa Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 27 Nov 2017 23:25:38 +0000 Subject: [msan] Avoid shadowing a variable in common interceptors. "offset" declared in a macro may shadow a variable with the same name in the caller which is used in a macro argument. We are quite lucky that it does not actually happen, but rename the variable anyway to be on the safe side. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319115 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/msan/msan_interceptors.cc | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'lib/msan/msan_interceptors.cc') diff --git a/lib/msan/msan_interceptors.cc b/lib/msan/msan_interceptors.cc index 43181fb9d..5abfb9ad0 100644 --- a/lib/msan/msan_interceptors.cc +++ b/lib/msan/msan_interceptors.cc @@ -86,22 +86,21 @@ static void *AllocateFromLocalPool(uptr size_in_bytes) { } while (0) // Check that [x, x+n) range is unpoisoned. -#define CHECK_UNPOISONED_0(x, n) \ - do { \ - sptr offset = __msan_test_shadow(x, n); \ - if (__msan::IsInSymbolizer()) \ - break; \ - if (offset >= 0 && __msan::flags()->report_umrs) { \ - GET_CALLER_PC_BP_SP; \ - (void) sp; \ - ReportUMRInsideAddressRange(__func__, x, n, offset); \ - __msan::PrintWarningWithOrigin( \ - pc, bp, __msan_get_origin((const char *)x + offset)); \ - if (__msan::flags()->halt_on_error) { \ - Printf("Exiting\n"); \ - Die(); \ - } \ - } \ +#define CHECK_UNPOISONED_0(x, n) \ + do { \ + sptr __offset = __msan_test_shadow(x, n); \ + if (__msan::IsInSymbolizer()) break; \ + if (__offset >= 0 && __msan::flags()->report_umrs) { \ + GET_CALLER_PC_BP_SP; \ + (void)sp; \ + ReportUMRInsideAddressRange(__func__, x, n, __offset); \ + __msan::PrintWarningWithOrigin( \ + pc, bp, __msan_get_origin((const char *)x + __offset)); \ + if (__msan::flags()->halt_on_error) { \ + Printf("Exiting\n"); \ + Die(); \ + } \ + } \ } while (0) // Check that [x, x+n) range is unpoisoned unless we are in a nested -- cgit v1.2.3