On Thu, Oct 25, 2012 at 02:32:33PM -0700, Wei Mi wrote: > 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 <w...@google.com> > > A small fix to remove bogus error report of global buffer overflow. > * varasm.c: correct the condition of asan_protected being true.
The patch is almost ok, the ChangeLog entry is not. Two instead of 3 spaces between date and name, no need for introductory comment above * varasm.c line, name of modified function and capital letter after :. Perhaps * varasm.c (assemble_variable): Set asan_protected even for decls that are already ASAN_RED_ZONE_SIZE or more bytes aligned. Ok with that Change and: > --- 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); Too long line, put ASAN_RED_ZONE_SIZE * BITS_PER_UNIT on next line below the second DECL_ALIGN (decl). Jakub