blob: eb48da8ff9e9ab07d3f98eb2efe49dab62fb98ff [file] [log] [blame]
serge_sans_paillee67cbac2019-09-09 16:59:34 +02001// Check the correct function attributes are generated
2// RUN: %clang_cc1 -triple x86_64-linux -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
Jonas Paulsson515bfc62020-04-21 18:16:29 +02003// RUN: %clang_cc1 -triple s390x-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
serge_sans_paillee67cbac2019-09-09 16:59:34 +02004
5// CHECK: define void @large_stack() #[[A:.*]] {
6void large_stack() {
7 volatile int stack[20000], i;
8 for (i = 0; i < sizeof(stack) / sizeof(int); ++i)
9 stack[i] = i;
10}
11
12// CHECK: define void @vla({{.*}}) #[[A:.*]] {
13void vla(int n) {
14 volatile int vla[n];
15 __builtin_memset(&vla[0], 0, 1);
16}
17
18// CHECK: define void @builtin_alloca({{.*}}) #[[A:.*]] {
19void builtin_alloca(int n) {
20 volatile void *mem = __builtin_alloca(n);
21}
22
23// CHECK: attributes #[[A]] = {{.*}} "probe-stack"="inline-asm"