18 lines · cpp
1// RUN: %clangxx_msan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s2 3#include <assert.h>4#include <dlfcn.h>5#include <stdlib.h>6 7static int my_global;8 9int main(void) {10 int *uninit = (int*)malloc(sizeof(int));11 my_global = *uninit;12 void *p = dlopen(0, RTLD_NOW);13 assert(p && "failed to get handle to executable");14 return my_global;15 // CHECK: MemorySanitizer: use-of-uninitialized-value16 // CHECK: #0 {{.*}} in main{{.*}}dlopen_executable.cpp:[[@LINE-2]]17}18