summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ssp-2.c
blob: 9a7ac3206fd8e5a0799c340cbd3aa68aed25dc2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-do run { target native } } */
/* { dg-options "-fstack-protector" } */
/* { dg-options "-fstack-protector -Wl,-multiply_defined,suppress" { target *-*-darwin* } } */
/* { dg-require-effective-target fstack_protector } */

#include <stdlib.h>

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

void
overflow()
{
  int i = 0;
  char foo[30];

  /* Overflow buffer.  */
  for (i = 0; i < 50; i++)
      foo[i] = 42;
}

int main (void)
{
  overflow ();
  return 1; /* fail */
}