Fixed memory corruption problem.

llvm-svn: 228736
This commit is contained in:
Andrey Churbanov 2015-02-10 20:10:21 +00:00
parent 7dc8af5306
commit b41e62b713
1 changed files with 4 additions and 0 deletions

View File

@ -350,6 +350,10 @@ public:
hierarchy_info() : depth(1), uninitialized(true) {} hierarchy_info() : depth(1), uninitialized(true) {}
void init(AddrUnsPair *adr2os, int num_addrs) 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; uninitialized = false;
for (kmp_uint32 i=0; i<maxLevels; ++i) { // init numPerLevel[*] to 1 item per level for (kmp_uint32 i=0; i<maxLevels; ++i) { // init numPerLevel[*] to 1 item per level
numPerLevel[i] = 1; numPerLevel[i] = 1;