================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck 
%s
+
+typedef __SIZE_TYPE__ size_t;
+
+int printf(const char * _Format, ...);
+char *strcpy(char *s1, const char *s2);
+
+struct S {
+  S();
+  int a[4];
+};
+
+// CHECK: define {{.*}} @_Z5test1PKc
+// CHECK: %a = alloca [1000 x i8], align {{.*}}, !stack-protector ![[A:.*]]
+void test1(const char *msg) {
+  __attribute__((stack_protector_ignore))
+  char a[1000];
+  strcpy(a, msg);
+  printf("%s\n", a);
+}
+
+// CHECK: define {{.*}} @_Z5test2
+// CHECK-NOT: %b = alloca [1000 x i8], align {{.*}}, !stack-protector
+void test2(const char *msg) {
+  char b[1000];
+  strcpy(b, msg);
+  printf("%s\n", b);
+}
+
+// CHECK: define {{.*}} @_Z5test3v
+// CHECK-NOT: %b = alloca [1000 x i8], align {{.*}}, !stack-protector
----------------
cooperp wrote:

Oh sorry silly copy/paste of the check line. I'd expect the alloca in test3 to 
have the attribute. I just checked for the wrong thing.

https://github.com/llvm/llvm-project/pull/173311
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to