[Bug sanitizer/84340] [8 regression] g++.dg/asan/use-after-scope-types-1.C (and others) fails after r257585

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 13 09:34:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84340

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 43401
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43401&action=edit
Untested patch

Problem here is that we can't have 'W' ('R' respectively) as the arguments are
read addresses and the internal functions write/read to shadow memory. Thus
can't have EAF_DIRECT flag set:

/* Call argument flags.  */
/* Nonzero if the argument is not dereferenced recursively, thus only
   directly reachable memory is read or written.  */
#define EAF_DIRECT              (1 << 0)

int
gimple_call_arg_flags (const gcall *stmt, unsigned arg)
{
  const_tree attr = gimple_call_fnspec (stmt);

  if (!attr || 1 + arg >= (unsigned) TREE_STRING_LENGTH (attr))
    return 0;

  switch (TREE_STRING_POINTER (attr)[1 + arg])
    {
    case 'x':
    case 'X':
      return EAF_UNUSED;

    case 'R':
      return EAF_DIRECT | EAF_NOCLOBBER | EAF_NOESCAPE;

    case 'r':
      return EAF_NOCLOBBER | EAF_NOESCAPE;

    case 'W':
      return EAF_DIRECT | EAF_NOESCAPE;

    case 'w':
      return EAF_NOESCAPE;

    case '.':
    default:
      return 0;
    }
}


More information about the Gcc-bugs mailing list