view gcc/testsuite/gcc.dg/stack-check-7.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-O2 -fstack-clash-protection -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
/* { dg-require-effective-target supports_stack_clash_protection } */

/* For further testing, this can be run under valgrind where it's crashed
   on aarch64 and ppc64le with -fstack-check=specific.  */


__attribute__((noinline, noclone)) void
foo (char *p)
{
  asm volatile ("" : : "r" (p) : "memory");
}

__attribute__((noinline, noclone)) void
bar (void)
{
  char buf[131072];
  foo (buf);
}

__attribute__((noinline, noclone)) void
baz (void)
{
  char buf[12000];
  foo (buf);
}

int
main ()
{
  bar ();
  baz ();
  return 0;
}