blob: 741fb755053c8e574e2621c98d9895f2d9453e38 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
Dmitri Gribenko97e948e2013-02-17 03:06:16 +00002// NOSSP: define void @test1(i8* %msg) nounwind {{.*}}{
Daniel Dunbara5728872009-12-15 20:14:24 +00003// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
Dmitri Gribenko97e948e2013-02-17 03:06:16 +00004// WITHSSP: define void @test1(i8* %msg) nounwind ssp {{.*}}{
Daniel Dunbara5728872009-12-15 20:14:24 +00005// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s
Dmitri Gribenko97e948e2013-02-17 03:06:16 +00006// SSPREQ: define void @test1(i8* %msg) nounwind sspreq {{.*}}{
7
8typedef __SIZE_TYPE__ size_t;
Bill Wendling45483f72009-06-28 07:36:13 +00009
Mike Stump76bee4b2009-10-08 23:05:06 +000010int printf(const char * _Format, ...);
Dmitri Gribenko97e948e2013-02-17 03:06:16 +000011size_t strlen(const char *s);
12char *strcpy(char *s1, const char *s2);
Bill Wendling45483f72009-06-28 07:36:13 +000013
14void test1(const char *msg) {
15 char a[strlen(msg) + 1];
16 strcpy(a, msg);
17 printf("%s\n", a);
18}