This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Move Asan instrumentation to sanopt pass


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]