Home | History | Annotate | Download | only in Windows
      1 // RUN: %clang_cl_asan -O0 %s -Fe%t
      2 // RUN: not %run %t 2>&1 | FileCheck %s
      3 
      4 struct C {
      5   int x;
      6   ~C() {}
      7 };
      8 
      9 int main() {
     10   C *buffer = new C[42];
     11   buffer[-2].x = 42;
     12 // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
     13 // CHECK: WRITE of size 4 at [[ADDR]] thread T0
     14 // CHECK-NEXT: {{#0 .* main .*operator_array_new_with_dtor_left_oob.cc}}:[[@LINE-3]]
     15 //
     16 // FIXME: Currently it says "4 bytes ... left of 172-byte region",
     17 //        should be "8 bytes ... left of 168-byte region", see
     18 //        https://code.google.com/p/address-sanitizer/issues/detail?id=314
     19 // CHECK: [[ADDR]] is located {{.*}} bytes to the left of 172-byte region
     20 // CHECK-LABEL: allocated by thread T0 here:
     21 // FIXME: The 'operator new' frame should have [].
     22 // CHECK-NEXT: {{#0 .* operator new}}
     23 // CHECK-NEXT: {{#1 .* main .*operator_array_new_with_dtor_left_oob.cc}}:[[@LINE-13]]
     24   delete [] buffer;
     25 }
     26