1 // Test that a stack overflow fails as expected
3 // RUN: %clang_noscs %s -o %t -DITERATIONS=3
4 // RUN: %run %t | FileCheck %s
5 // RUN: %clang_noscs %s -o %t -DITERATIONS=12
6 // RUN: %run %t | FileCheck -check-prefix=OVERFLOW_SUCCESS %s
8 // RUN: %clang_scs %s -o %t -DITERATIONS=3
9 // RUN: %run %t | FileCheck %s
11 // On aarch64 we just load the return address from the shadow call stack so we
12 // do not expect to see the output from print_and_exit.
13 // RUN: %clang_scs %s -o %t -DITERATIONS=12
14 // RUN: %run %t | FileCheck %S/overflow.c
19 #include "minimal_runtime.h"
21 void print_and_exit(void) {
22 // CHECK-NOT: Stack overflow successful.
23 // OVERFLOW_SUCCESS: Stack overflow successful.
24 scs_fputs_stdout("Stack overflow successful.\n");
31 for (int i
= 0; i
< ITERATIONS
; i
++)
32 addrs
[i
] = &print_and_exit
;
34 scs_fputs_stdout("Returning.\n");