summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ssp-1.c
blob: 5467f4dc36cd7af0d46837344d2e9911f29b4f80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do run { target native } } */
/* { dg-options "-fstack-protector" } */
/* { dg-require-effective-target fstack_protector } */

#include <stdlib.h>

void
__stack_chk_fail (void)
{
  exit (0); /* pass */
}

int main ()
{
  int i;
  char foo[255];

  // smash stack
  for (i = 0; i <= 400; i++)
    foo[i] = 42;

  return 1; /* fail */
}