This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[asan] a small patch to fix bogus error about global buffer overflow
- From: Wei Mi <wmi at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Diego Novillo <dnovillo at google dot com>, David Li <davidxl at google dot com>, Jakub Jelinek <jakub at redhat dot com>, Dodji Seketeli <dseketel at redhat dot com>, Andrew Pinski <pinskia at gmail dot com>
- Date: Thu, 25 Oct 2012 14:32:33 -0700
- Subject: [asan] a small patch to fix bogus error about global buffer overflow
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.