aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/stackprotectexplicit2.C
blob: 70d8df4c73de2447d9ac29d7d37121fb2fdf6dbe (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
/* Test that stack protection is done on chosen functions. */

/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fstack-protector-explicit" } */
/* { dg-additional-options "-fno-PIE" { target ia32 } } */

int A()
{
	int A[23];
	char b[22];
	return 0;
}

int __attribute__((stack_protect)) B()
{
	int a;
	int b;
	return a+b;
}

int __attribute__((stack_protect)) c()
{
	int a;
	char b[34];
	return 0;
}


/* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */