stack-protector.c revision 97e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2
1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
297e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenko// NOSSP: define void @test1(i8* %msg) nounwind {{.*}}{
3a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
497e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenko// WITHSSP: define void @test1(i8* %msg) nounwind ssp {{.*}}{
5a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s
697e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenko// SSPREQ: define void @test1(i8* %msg) nounwind sspreq {{.*}}{
797e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenko
897e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenkotypedef __SIZE_TYPE__ size_t;
945483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendling
1076bee4b756badefda61ce867c757cc31b7afa12fMike Stumpint printf(const char * _Format, ...);
1197e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenkosize_t strlen(const char *s);
1297e948e9c9cc2db9f0cdc13e708fe1bd8c6d05a2Dmitri Gribenkochar *strcpy(char *s1, const char *s2);
1345483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendling
1445483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendlingvoid test1(const char *msg) {
1545483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendling  char a[strlen(msg) + 1];
1645483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendling  strcpy(a, msg);
1745483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendling  printf("%s\n", a);
1845483f7a1b3e57b4603b141bee80596b2d4dd443Bill Wendling}
19