Static initialization order fiasco
Status: Beta
Brought to you by:
kevina
There is static initialization order fiasco while creating GlobalCacheBase. The global_cache_lock static variable may not be initialized when GlobalCacheBase is constructed.
static StackPtr<Mutex> global_cache_lock(new Mutex);
One of the instances where this is possible is from typo_edit_dist.cpp
static GlobalCache<TypoEditDistanceInfo> typo_edit_dist_info_cache("keyboard");
This was found by AddressSanitizer:
Here is a proposed patch.
Edit: I needed to add a missing include in one unrelated file as well (for ptrdiff_t).
Last edit: Dhyanesh Damania 2013-05-27
There are more issues that I found. Here is a complete patch.
This issue has moved to GitHub: https://github.com/GNUAspell/aspell/issues/512