From b41e62b713026d958ed5f7e86418217011f3676e Mon Sep 17 00:00:00 2001 From: Andrey Churbanov Date: Tue, 10 Feb 2015 20:10:21 +0000 Subject: Fixed memory corruption problem. llvm-svn: 228736 --- openmp/runtime/src/kmp_affinity.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openmp/runtime/src') diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp index b16b458d215..5786d302251 100644 --- a/openmp/runtime/src/kmp_affinity.cpp +++ b/openmp/runtime/src/kmp_affinity.cpp @@ -350,6 +350,10 @@ public: hierarchy_info() : depth(1), uninitialized(true) {} void init(AddrUnsPair *adr2os, int num_addrs) { + /* Added explicit initialization of the depth here to prevent usage of dirty value + observed when static library is re-initialized multiple times (e.g. when + non-OpenMP thread repeatedly launches/joins thread that uses OpenMP). */ + depth = 1; uninitialized = false; for (kmp_uint32 i=0; i