www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Issue in _d_dso_registry on Linux when unloading DSO's

I'm running into this issue when I compile DRuntime in debug. In 
sections_elf_shared.d, there's an assert on line 454 
(assert(pdso._tlsSize == _tlsRanges.back.length);). Because of 
this line, I get an assertion thrown, where the actual issue is 
that _tlsRanges is empty and thus has no "back". The GC has been 
finalized at this point in the program and can't actually 
allocate the assertion, so I end up with a segfault.

The whole bit of code looks like this:

assert(pdso._tlsSize == _tlsRanges.back.length);
assert(pdso == _loadedDSOs.back);

Right now my "fix" looks like this:

    assert(pdso._tlsSize == _tlsRanges.back.length);
assert(pdso == _loadedDSOs.back);

I have no idea if this is safe to do since I am not familiar with 
this code, but at least I don't have a segfault anymore. Can 
anyone help me figure out what is going on?
Apr 03