diff options
Diffstat (limited to 'test/msan/dlopen_executable.cc')
-rw-r--r-- | test/msan/dlopen_executable.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/msan/dlopen_executable.cc b/test/msan/dlopen_executable.cc new file mode 100644 index 000000000000..ac8a14b94078 --- /dev/null +++ b/test/msan/dlopen_executable.cc @@ -0,0 +1,17 @@ +// RUN: %clangxx_msan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s + +#include <assert.h> +#include <dlfcn.h> +#include <stdlib.h> + +static int my_global; + +int main(void) { + int *uninit = (int*)malloc(sizeof(int)); + my_global = *uninit; + void *p = dlopen(0, RTLD_NOW); + assert(p && "failed to get handle to executable"); + return my_global; + // CHECK: MemorySanitizer: use-of-uninitialized-value + // CHECK: #0 {{.*}} in main{{.*}}dlopen_executable.cc:[[@LINE-2]] +} |