stack-protector.c revision 4fcfde4d5c8f25e40720972a5543d538a0dcb220
1// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s
2// RUN: not grep 'ssp' %t
3// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s
4// RUN: not grep 'ssp' %t
5// RUN: clang-cc -triple i686-apple-darwin10 -emit-llvm -o %t %s
6// RUN: grep 'ssp' %t
7// RUN: clang -fstack-protector-all -emit-llvm -S -o %t %s
8// RUN: grep 'sspreq' %t
9// RUN: clang -fstack-protector -emit-llvm -S -o %t %s
10// RUN: grep 'ssp' %t
11// RUN: clang -fno-stack-protector -emit-llvm -S -o %t %s
12// RUN: not grep 'ssp' %t
13// RUN: true
14
15int printf(const char * _Format, ...);
16
17void test1(const char *msg) {
18  char a[strlen(msg) + 1];
19  strcpy(a, msg);
20  printf("%s\n", a);
21}
22