This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Move Asan instrumentation to sanopt pass
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Yury Gribov <y dot gribov at samsung dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Konstantin Serebryany <kcc at gcc dot gnu dot org>, Dmitry Vyukov <dvyukov at google dot com>, Viacheslav Garbuzov <v dot garbuzov at samsung dot com>, Marek Polacek <polacek at redhat dot com>
- Date: Fri, 1 Aug 2014 09:17:57 +0200
- Subject: Re: [PATCH] Move Asan instrumentation to sanopt pass
- Authentication-results: sourceware.org; auth=none
- References: <53C922DE dot 6020000 at samsung dot com> <CAFiYyc3=eaf92H=H-wUv3OUx-62s7_Vup8h0TAbLe_gBmTQp_A at mail dot gmail dot com> <53CE720A dot 4030002 at samsung dot com> <CAFiYyc0Fv5jWCNwcZU=2MYHSqo0h=ZdsBvMas4rUhEPsNevmVg at mail dot gmail dot com> <20140723200935 dot GB2397 at laptop dot redhat dot com> <53D0A5DA dot 4020301 at samsung dot com> <20140724074851 dot GD2397 at laptop dot redhat dot com> <53D65AB0 dot 4090807 at samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jul 28, 2014 at 06:14:08PM +0400, Yury Gribov wrote:
> On 07/24/2014 11:48 AM, Jakub Jelinek wrote:
> > So, either support for just EAF*, or perhaps support for DECL_ATTRIBUTES
> > for internal-fns, say by having some tree array where you'd store what you
> > stick into DECL_ATTRIBUTES normally.
>
> I'd prefer to avoid attributes. Would something like this be enough?
> (not yet fully tested, just ran asan.exp tests).
I think I'd prefer if you'd specify the fnspec as either NULL (most internal
functions) or normal string and reuse the string parsing in
gimple_call_arg_flags.
So, you'd just replace the:
tree attr = gimple_call_fnspec (stmt);
if (!attr || 1 + arg >= (unsigned) TREE_STRING_LENGTH (attr))
return 0;
switch (TREE_STRING_POINTER (attr)[1 + arg])
with:
const char *fnspec;
if (gimple_call_arg_flags (stmt))
{
fnspec = ...;
if (!fnspec || 1 + arg >= strlen (fnspec))
return 0;
}
else
{
tree attr = gimple_call_fnspec (stmt);
if (!attr || 1 + arg >= (unsigned) TREE_STRING_LENGTH (attr))
return 0;
fnspec = TREE_STRING_POINTER (attr);
}
switch (fnspec[1 + arg])
Jakub