summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/stack-protector.c
blob: 0b5924d811122f1822d57ff8f471610ccab29ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s &&
// RUN: not grep 'ssp' %t &&
// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s &&
// RUN: not grep 'ssp' %t &&
// RUN: clang-cc -triple i686-apple-darwin10 -emit-llvm -o %t %s &&
// RUN: grep 'ssp' %t &&
// RUN: clang -fstack-protector-all -emit-llvm -S -o %t %s &&
// RUN: grep 'sspreq' %t &&
// RUN: clang -fstack-protector -emit-llvm -S -o %t %s &&
// RUN: grep 'ssp' %t &&
// RUN: clang -fno-stack-protector -emit-llvm -S -o %t %s &&
// RUN: not grep 'ssp' %t &&
// RUN: true

int printf(const char * _Format, ...);

void test1(const char *msg) {
  char a[strlen(msg) + 1];
  strcpy(a, msg);
  printf("%s\n", a);
}
OpenPOWER on IntegriCloud