summaryrefslogtreecommitdiff
path: root/test/msan/Linux/bzero.cc
blob: cb319a6cfa1e347cd663f911edfbc98ed558bb45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// RUN: %clangxx_msan -O0 %s -o %t && %run %t

// REQUIRES: !android

#include <assert.h>
#include <strings.h>
#include <sanitizer/msan_interface.h>

int main(int argc, char *argv[]) {
  char buf[100];
  assert(0 == __msan_test_shadow(buf, sizeof(buf)));
  // *& to suppress bzero-to-memset optimization.
  (*&bzero)(buf, 50);
  assert(50 == __msan_test_shadow(buf, sizeof(buf)));
  return 0;
}