glue.cc RegisterWarning is called for statically initialized variables in main.cc lines 293-305.
RegsiterWarning itself is using two statically allocated STL containers: messages and abbrev2Message.
The order of initialization for these variables is not defined, and causes SIGSEGV when map/list methods are called on un-initialized members or abbrev2Message.
The proposed patch changes static members to pointer (static memory is guaranteed to be zero-filled), and allocated them via new prior to any reference if pointers are NULL:
src/glue.h
101,102c101,102
< static map<string,Message*> abbrev2Message; ///< abbreviation to object map
< static list<Message*> messages; ///< list of all messages
---
> static map<string,Message*> *abbrev2Message; ///< abbreviation to object map
> static list<Message*> *messages; ///< list of all messages
148c148
< static list<Message*>& MessageList() { return messages; }
---
> static list<Message*>& MessageList() { return *messages; }
src/glue.cc
40,41c40,41
< map<string,Message*> Message::abbrev2Message;
< list<Message*> Message::messages;
---
> map<string,Message*>* Message::abbrev2Message = NULL;
> list<Message*>* Message::messages = NULL;
89a90
>
99c100,104
< if( abbrev2Message.find(abbrev) == abbrev2Message.end() ) {
---
> if (abbrev2Message == NULL) {
> abbrev2Message = new map<string, Message*>;
> }
>
> if( abbrev2Message->find(abbrev) == abbrev2Message->end() ) {
102c107
< return abbrev2Message[abbrev];
---
> return (*abbrev2Message)[abbrev];
127,129c132,140
< MASSERT( abbrev2Message.find(abbrev) == abbrev2Message.end() );
< abbrev2Message[abbrev] = this;
< messages.push_back(this);
---
> if (abbrev2Message == NULL) {
> abbrev2Message = new map<string, Message*>;
> }
> if (messages == NULL) {
> messages = new list<Message*>;
> }
> MASSERT( abbrev2Message->find(abbrev) == abbrev2Message->end() );
> abbrev2Message->insert(pair<string, Message*>(abbrev, this));
> messages->push_back(this);