summaryrefslogtreecommitdiff
path: root/lib/msan/lit_tests/errno.cc
blob: af27ad0b03298763ceb31e1bf4c69c3bb493590f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clangxx_msan -m64 -O0 %s -o %t && %t

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

int main()
{
  int x;
  int *volatile p = &x;
  errno = *p;
  int res = read(-1, 0, 0);
  assert(res == -1);
  if (errno) printf("errno %d\n", errno);
  return 0;
}