Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_asan -O0 %s -o %t |
| 2 | // RUN: not %run %t 2>&1 | FileCheck %s |
| 3 | // RUN: not %run %t heap 2>&1 | FileCheck %s |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 4 | // RUN: %env_asan_opts=poison_partial=0 %run %t |
| 5 | // RUN: %env_asan_opts=poison_partial=0 %run %t heap |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 6 | #include <string.h> |
| 7 | char g[21]; |
| 8 | char *x; |
| 9 | |
| 10 | int main(int argc, char **argv) { |
| 11 | if (argc >= 2) |
| 12 | x = new char[21]; |
| 13 | else |
| 14 | x = &g[0]; |
| 15 | memset(x, 0, 21); |
| 16 | int *y = (int*)x; |
| 17 | return y[5]; |
| 18 | } |
| 19 | // CHECK: 0 bytes to the right |