21 lines · c
1// RUN: %clang_msan %s -o %t2// RUN: env MSAN_OPTIONS=intercept_strcmp=false %run %t 2>&13// RUN: env MSAN_OPTIONS=intercept_strcmp=true not %run %t 2>&1 | FileCheck %s4// RUN: not %run %t 2>&1 | FileCheck %s5 6#include <assert.h>7#include <stdlib.h>8#include <string.h>9 10int main(int argc, char **argv) {11 char undef;12 char s1[] = "abcd";13 char s2[] = "1234";14 assert(strcmp(s1, s2) > 0);15 s2[0] = undef;16 assert(strcmp(s1, s2));17 18 // CHECK: {{.*WARNING: MemorySanitizer: use-of-uninitialized-value}}19 return 0;20}21