[asan] a small patch to fix bogus error about global buffer overflow
Wei Mi
wmi@google.com
Thu Oct 25 21:45:00 GMT 2012
Hi,
A small patch to remove the bogus error reports exposed in the
spec2000 testing. In varasm.c, asan_protected should be equivalent
with asan_protect_global (decl) all the time, or else compiler will
not insert redzones for some globals planned to be protected.
gcc/ChangeLog:
2012-10-25 Wei Mi <wmi@google.com>
A small fix to remove bogus error report of global buffer overflow.
* varasm.c: correct the condition of asan_protected being true.
Index: varasm.c
===================================================================
--- varasm.c (revision 192822)
+++ varasm.c (working copy)
@@ -1991,11 +1991,10 @@ assemble_variable (tree decl, int top_le
align_variable (decl, dont_output_data);
if (flag_asan
- && asan_protect_global (decl)
- && DECL_ALIGN (decl) < ASAN_RED_ZONE_SIZE * BITS_PER_UNIT)
+ && asan_protect_global (decl))
{
asan_protected = true;
- DECL_ALIGN (decl) = ASAN_RED_ZONE_SIZE * BITS_PER_UNIT;
+ DECL_ALIGN (decl) = MAX (DECL_ALIGN (decl), ASAN_RED_ZONE_SIZE
* BITS_PER_UNIT);
}
set_mem_align (decl_rtl, DECL_ALIGN (decl));
Thanks,
Wei.
More information about the Gcc-patches
mailing list