2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
|
2013-02-20 15:22:19 +08:00
|
|
|
// NOSSP: define void @test1(i8* %msg) #0 {
|
2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
|
2013-02-20 15:22:19 +08:00
|
|
|
// WITHSSP: define void @test1(i8* %msg) #0 {
|
2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s
|
2013-02-20 15:22:19 +08:00
|
|
|
// SSPREQ: define void @test1(i8* %msg) #0 {
|
2013-02-17 11:06:16 +08:00
|
|
|
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
2009-06-28 15:36:13 +08:00
|
|
|
|
2009-10-09 07:05:06 +08:00
|
|
|
int printf(const char * _Format, ...);
|
2013-02-17 11:06:16 +08:00
|
|
|
size_t strlen(const char *s);
|
|
|
|
char *strcpy(char *s1, const char *s2);
|
2009-06-28 15:36:13 +08:00
|
|
|
|
|
|
|
void test1(const char *msg) {
|
|
|
|
char a[strlen(msg) + 1];
|
|
|
|
strcpy(a, msg);
|
|
|
|
printf("%s\n", a);
|
|
|
|
}
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
|