• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clangxx_msan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 
3 #include <assert.h>
4 #include <dlfcn.h>
5 #include <stdlib.h>
6 
7 static int my_global;
8 
main(void)9 int 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-value
16   // CHECK: #0 {{.*}} in main{{.*}}dlopen_executable.cpp:[[@LINE-2]]
17 }
18