| 1 |
/// Check that stack frame size warnings behave the same when safe stack is enabled |
| 2 |
|
| 3 |
// REQUIRES: x86-registered-target |
| 4 |
|
| 5 |
// RUN: %clang_cc1 %s -fwarn-stack-size=48 -S -o - -triple=i386-apple-darwin 2>&1 | FileCheck --check-prefix=REGULAR %s |
| 6 |
// RUN: %clang_cc1 %s -fwarn-stack-size=1060 -S -o - -triple=i386-apple-darwin 2>&1 | FileCheck --check-prefix=IGNORE %s |
| 7 |
|
| 8 |
// RUN: %clang_cc1 %s -fsanitize=safe-stack -fwarn-stack-size=48 -S -o - -triple=i386-apple-darwin 2>&1 | FileCheck --check-prefix=SAFESTACK %s |
| 9 |
// RUN: %clang_cc1 %s -fsanitize=safe-stack -fwarn-stack-size=1060 -S -o - -triple=i386-apple-darwin 2>&1 | FileCheck --check-prefix=IGNORE %s |
| 10 |
|
| 11 |
extern void init(char *buf, int size); |
| 12 |
extern int use_buf(char *buf, int size); |
| 13 |
|
| 14 |
// REGULAR: warning: stack frame size ([[#]]) exceeds limit ([[#]]) in 'stackSizeWarning' |
| 15 |
// SAFESTACK: warning: stack frame size ([[#]]) exceeds limit ([[#]]) in 'stackSizeWarning' |
| 16 |
// IGNORE-NOT: stack frame size ([[#]]) exceeds limit ([[#]]) in 'stackSizeWarning' |
| 17 |
void stackSizeWarning() { |
| 18 |
char buf[1024]; |
| 19 |
init(buf, sizeof(buf)); |
| 20 |
if (buf[0] < 42) |
| 21 |
use_buf(buf, sizeof(buf)); |
| 22 |
} |