blob: 8a8921566dbc9a0b012329917787f9acf9bfbd68 [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001// 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 Nainarcdce50b2015-07-01 12:26:56 -07004// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:poison_partial=0 %run %t
5// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:poison_partial=0 %run %t heap
Stephen Hines2d1fdb22014-05-28 23:58:16 -07006#include <string.h>
7char g[21];
8char *x;
9
10int 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