diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-02 18:30:55 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-02 18:30:55 +0000 |
| commit | 8d8e909cdc9f4e78e1e1600497d827e1acde6cea (patch) | |
| tree | c8c6047827589e56f2ed1f77f23b1f7d1a10e793 /test/asan/TestCases/Linux/global-overflow-lld.cc | |
| parent | 2953104c9a262728031dc518429d15b969dd6028 (diff) | |
Notes
Diffstat (limited to 'test/asan/TestCases/Linux/global-overflow-lld.cc')
| -rw-r--r-- | test/asan/TestCases/Linux/global-overflow-lld.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/global-overflow-lld.cc b/test/asan/TestCases/Linux/global-overflow-lld.cc new file mode 100644 index 000000000000..f4d0bc977604 --- /dev/null +++ b/test/asan/TestCases/Linux/global-overflow-lld.cc @@ -0,0 +1,19 @@ +// Test that gc-sections-friendly instrumentation of globals does not introduce +// false negatives with the LLD linker. +// RUN: %clangxx_asan -fuse-ld=lld -Wl,-gc-sections -ffunction-sections -fdata-sections -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s +// REQUIRES: lld + +#include <string.h> +int main(int argc, char **argv) { + static char XXX[10]; + static char YYY[10]; + static char ZZZ[10]; + memset(XXX, 0, 10); + memset(YYY, 0, 10); + memset(ZZZ, 0, 10); + int res = YYY[argc * 10]; // BOOOM + // CHECK: {{READ of size 1 at}} + // CHECK: {{located 0 bytes to the right of global variable}} + res += XXX[argc] + ZZZ[argc]; + return res; +} |
