blob: 54699f044ae48f9f846360bd94d689a58b49cd38 [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
Kai Luo68e07da2020-07-05 03:40:40 +00004// RUN: %clang_cc1 -triple powerpc64le-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
5// RUN: %clang_cc1 -triple powerpc64-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
serge_sans_paillee67cbac2019-09-09 16:59:34 +02006
7// CHECK: define void @large_stack() #[[A:.*]] {
8void large_stack() {
9 volatile int stack[20000], i;
10 for (i = 0; i < sizeof(stack) / sizeof(int); ++i)
11 stack[i] = i;
12}
13
14// CHECK: define void @vla({{.*}}) #[[A:.*]] {
15void vla(int n) {
16 volatile int vla[n];
17 __builtin_memset(&vla[0], 0, 1);
18}
19
20// CHECK: define void @builtin_alloca({{.*}}) #[[A:.*]] {
21void builtin_alloca(int n) {
22 volatile void *mem = __builtin_alloca(n);
23}
24
25// CHECK: attributes #[[A]] = {{.*}} "probe-stack"="inline-asm"