On Thu, Dec 01, 2016 at 01:25:43PM +0300, Maxim Ostapenko wrote: > + int len = strlen (IDENTIFIER_POINTER (decl_name)) > + + sizeof ("__odr_asan_") + 1;
Please use size_t len instead of int len. Why the + 1? sizeof ("__odr_asan_") should be already strlen ("__odr_asan_") + 1. > + name = XALLOCAVEC (char, len); > + name[len] = '\0'; This is buffer overflow. Why do you need it at all? > + snprintf (name, len, "__odr_asan_%s", IDENTIFIER_POINTER (decl_name)); This should zero terminate the string. Also, shouldn't this be followed by: #ifndef NO_DOT_IN_LABEL name[sizeof ("__odr_asan") - 1] = '.'; #elif !defined(NO_DOLLAR_IN_LABEL) name[sizeof ("__odr_asan") - 1] = '$'; #endif to make it not possible to clash with user symbols __odr_asan_foobar etc. if possible (on targets which don't allow dots nor dollars in labels that is not really possible, but at least elsewhere). That said, if the __odr_asan* symbols are exported, it is part of ABI, so what exactly does LLVM use in those cases? > +/* { dg-final { scan-assembler-not ".*odr_asan_a.*" } } */ > +/* { dg-final { scan-assembler-not ".*odr_asan_b.*" } } */ > +/* { dg-final { scan-assembler ".*odr_asan_c.*" } } */ The .* on either side makes no sense, please remove those. And, if the dot or dollar is replacing _, you need to use "odr_asan.a" etc. in the regexps. Otherwise LGTM. Jakub