delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/09/02/05:11:14

From: lhall AT rfk DOT com (Larry Hall RFK Partners Inc)
Subject: Re: B19: G++ Bug
2 Sep 1998 05:11:14 -0700 :
Message-ID: <3.0.5.32.19980901151638.00afc4e0.cygnus.gnu-win32@pop.ma.ultranet.com>
References: <35EBB0E2 DOT E4612E45 AT debis DOT spb DOT ru>
Mime-Version: 1.0
To: "Volker H. Simonis" <simonis AT debis DOT spb DOT ru>, gnu-win32 AT cygnus DOT com

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

Larry Hall                              lhall AT rfk DOT com
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
>"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
>
>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019