summaryrefslogtreecommitdiff
path: root/test/msan/errno.cc
blob: 6ed0fd4108e6ad2999d9dca314958d7d4170f532 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clangxx_msan -O0 %s -o %t && %run %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;
}