annotate compiler-rt/test/msan/memcmp_test.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clangxx_msan -O0 -g %s -o %t
anatofuz
parents:
diff changeset
2 // RUN: not %run %t 2>&1 | FileCheck %s
anatofuz
parents:
diff changeset
3 // RUN: MSAN_OPTIONS=intercept_memcmp=0 %run %t
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 #include <string.h>
anatofuz
parents:
diff changeset
6 #include <stdio.h>
anatofuz
parents:
diff changeset
7 int main(int argc, char **argv) {
anatofuz
parents:
diff changeset
8 char a1[4];
anatofuz
parents:
diff changeset
9 char a2[4];
anatofuz
parents:
diff changeset
10 for (int i = 0; i < argc * 3; i++)
anatofuz
parents:
diff changeset
11 a2[i] = a1[i] = i;
anatofuz
parents:
diff changeset
12 int res = memcmp(a1, a2, 4);
anatofuz
parents:
diff changeset
13 if (!res)
anatofuz
parents:
diff changeset
14 printf("equals");
anatofuz
parents:
diff changeset
15 return 0;
anatofuz
parents:
diff changeset
16 // CHECK: Uninitialized bytes in MemcmpInterceptorCommon at offset 3
anatofuz
parents:
diff changeset
17 // CHECK: MemorySanitizer: use-of-uninitialized-value
anatofuz
parents:
diff changeset
18 }