view gcc/testsuite/g++.dg/asan/function-argument-3.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line source

// { dg-do run }
// { dg-shouldfail "asan" }
// { dg-additional-options "-Wno-psabi" }

typedef int v4si __attribute__ ((vector_size (16)));

static __attribute__ ((noinline)) int
goo (v4si *a)
{
  return (*(volatile v4si *) (a + 1))[2];
}

__attribute__ ((noinline)) int
foo (v4si arg)
{
  return goo (&arg);
}

int
main ()
{
  v4si v = {1,2,3,4};
  return foo (v);
}

// { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" }
// { dg-output "READ of size . at.*" }
// { dg-output ".*'arg' \\(line 14\\) <== Memory access at offset \[0-9\]* overflows this variable.*" }