view gcc/testsuite/g++.dg/asan/function-argument-4.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

// { dg-do run }
// { dg-shouldfail "asan" }

#include <complex.h>

static __attribute__ ((noinline)) long double
goo (long double _Complex *a)
{
  return crealf(*(volatile _Complex long double *)a);
}

__attribute__ ((noinline)) float
foo (float _Complex arg)
{
  return goo ((long double _Complex *)&arg);
}

int
main ()
{
  return foo (3 + 2 * I);
}

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