Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame^] | 2 | // NOSSP: define void @test1(i8* %msg) #0 { |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame^] | 4 | // WITHSSP: define void @test1(i8* %msg) #0 { |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 5 | // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame^] | 6 | // SSPREQ: define void @test1(i8* %msg) #0 { |
Dmitri Gribenko | 97e948e | 2013-02-17 03:06:16 +0000 | [diff] [blame] | 7 | |
| 8 | typedef __SIZE_TYPE__ size_t; |
Bill Wendling | 45483f7 | 2009-06-28 07:36:13 +0000 | [diff] [blame] | 9 | |
Mike Stump | 76bee4b | 2009-10-08 23:05:06 +0000 | [diff] [blame] | 10 | int printf(const char * _Format, ...); |
Dmitri Gribenko | 97e948e | 2013-02-17 03:06:16 +0000 | [diff] [blame] | 11 | size_t strlen(const char *s); |
| 12 | char *strcpy(char *s1, const char *s2); |
Bill Wendling | 45483f7 | 2009-06-28 07:36:13 +0000 | [diff] [blame] | 13 | |
| 14 | void test1(const char *msg) { |
| 15 | char a[strlen(msg) + 1]; |
| 16 | strcpy(a, msg); |
| 17 | printf("%s\n", a); |
| 18 | } |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame^] | 19 | |
| 20 | // NOSSP: attributes #0 = { nounwind "target-features"={{.*}} } |
| 21 | // NOSSP: attributes #1 = { "target-features"={{.*}} } |
| 22 | // NOSSP: attributes #2 = { nounwind } |
| 23 | |
| 24 | // WITHSSP: attributes #0 = { nounwind ssp "target-features"={{.*}} } |
| 25 | // WITHSSP: attributes #1 = { "target-features"={{.*}} } |
| 26 | // WITHSSP: attributes #2 = { nounwind } |
| 27 | |
| 28 | // SSPREQ: attributes #0 = { nounwind sspreq "target-features"={{.*}} } |
| 29 | // SSPREQ: attributes #1 = { "target-features"={{.*}} } |
| 30 | // SSPREQ: attributes #2 = { nounwind } |