Subject: Re: B19: G++ Bug
From: [email-masked] (Larry Hall RFK Partners Inc)

2 Sep 1998 05:11:14 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: "Volker H. Simonis" <[email-masked]>, [email-masked]

Mumit's looking at this now.  I think a patch is in the works...

Larry Hall                              [email-masked]
RFK Partners, Inc.                      (781) 239-1053
8 Grove Street                          (781) 239-1655 - FAX
Wellesley, MA  02482-7797               http://www.rfk.com

At 10:31 AM 9/1/98 +0200, Volker H. Simonis wrote:
>it's 10 days ago that i submitted nearly the same bug report 
>to the mailing list, unfortunately nobody answerd. the subject
>of the mail was : "B19: problem initialising global objects".
>it seems to me that this is not only a problem of correctly
>initialising stdio but a general problem of initialising global
>objects, since it can happen in other objects like for example 
>maps too.
>
>following the text of my initial bug report :
>
>/////////////////////////////////////////////////////////////
>/////////////////////////////////////////////////////////////
>
>i'm using b19 with egcs1.0.2 on NT4.0.
>while porting a program which works fine with egcs1.02 under linux,
>i encountered big problems under cygwin32.
>it seems to me that global objects (such as for example static class
>members)
>don't get initialised properly before program start.
>
>take for example the following short program :
>///////////////////////////////////////////////////////////////
>
>#include 
>class Bug {
>public:
>  Bug() { cout << "Bug() constructed" << endl; }
>};
>int main() {
>Bug BUG;
>}
>///////////////////////////////////////////////////////////////
>
>it works perfectly fine and prints out :
>> Bug() constructed
>
>But if we make BUG a globale variable by moving it outside
>of main, like in the following example :
>///////////////////////////////////////////////////////////////
>
>#include 
>class Bug {
>public:
>  Bug() { cout << "Bug() constructed" << endl; }
>};
>Bug BUG;
>int main() {
>}
>//////////////////////////////////////////////////////////////////
>
>we get a perfect segmentation fault, saying :
>
>> Exception: STATUS_ACCES_VIOLATION
>
>with gdb we can localize the error to happen in  :
>------------------------------------------------------------------
>
>ostream::operator<< (this=0x41100c, s=0x401040 "Bug() constructed") 
>at libio/iostream.cc:784
>-------------------------------------------------------------------
>
>it seems to me that cout has not been initialized properly before 
>the initialisation of BUG where it is used. Is this true ?
>
>as i have a lot of static and global objects with complex 
>constructors, this is a big problem for me.
>
>does anybody know the exact reason of this error an possible 
>workarounds ?
>any information appreciated.
>
>volker
>-
>For help on using this list (especially unsubscribing), send a message to
>"[email-masked]" with one line of text: "help".
>
>
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".