summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/hwasan/TestCases/new-test.cpp
blob: 3b1991e4deaa55a69c5303629ba56aca3c69b9a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test basic new functionality.
// RUN: %clangxx_hwasan %s -o %t
// RUN: %run %t

#include <stdlib.h>
#include <assert.h>
#include <sanitizer/hwasan_interface.h>
#include <sanitizer/allocator_interface.h>

int main() {
  __hwasan_enable_allocator_tagging();

  size_t volatile n = 0;
  char *a1 = new char[n];
  assert(a1 != nullptr);
  assert(__sanitizer_get_allocated_size(a1) == 0);
  delete[] a1;
}
OpenPOWER on IntegriCloud