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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Short testcase (meant for c-c++-common/asan/pr80308.c (or
gcc.dg/asan/pr80308.c):
/* PR sanitizer/80308 */
/* { dg-do run } */

__attribute__((noinline, noclone)) int
foo (char *a)
{
  int i, j = 0;
  asm volatile ("" : "+r" (a) : : "memory");
  for (i = 0; i < 12; i++)
    j += a[i];
  return j;
}

int
main ()
{
  int i, j = 0;
  for (i = 0; i < 4; i++)
    {
      char a[12];
      __builtin_memset (a, 0, sizeof (a));
      j += foo (a);
    }
  return j;
}

==34168==ERROR: AddressSanitizer: unknown-crash on address 0x3fffd50849b4 at pc
0x3fff7c76c028 bp 0x3fffd5084020 sp 0x3fffd5084090
WRITE of size 12 at 0x3fffd50849b4 thread T0
    #0 0x3fff7c76c024 in __interceptor_memset
../../../../libsanitizer/asan/asan_interceptors.cc:471
...
=>0x09fffaa10930: 00 00 f1 f1 f1 f1[04]00 f2 f2 f3 f3 f3 f3 00 00

with unpatched gcc on ppc64 (-m64).

Reply via email to