public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/501
@ 2001-04-01 0:00 neil
0 siblings, 0 replies; only message in thread
From: neil @ 2001-04-01 0:00 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4129 bytes --]
The following reply was made to PR libstdc++/501; it has been noted by GNATS.
From: neil@gcc.gnu.org
To: electro@alpha.ece.ucsb.edu, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: libstdc++/501
Date: 24 Jan 2001 21:12:52 -0000
Synopsis: egcs crash on std::std.flush()
State-Changed-From-To: analyzed->closed
State-Changed-By: neil
State-Changed-When: Wed Jan 24 13:12:52 2001
State-Changed-Why:
Appears fixed in CVS:-
bash-2.04$ g++ /tmp/test.C
/tmp/test.C: In function `int main()':
/tmp/test.C:7: `std' undeclared in namespace `std'
bash-2.04$
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=501&database=gcc
>From rodrigc@mediaone.net Sun Apr 01 00:00:00 2001
From: Craig Rodrigues <rodrigc@mediaone.net>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: Re: c++/1843
Date: Sun, 01 Apr 2001 00:00:00 -0000
Message-id: <20010219011601.20008.qmail@sourceware.cygnus.com>
X-SW-Source: 2001-q1/msg01475.html
Content-length: 3123
The following reply was made to PR c++/1843; it has been noted by GNATS.
From: Craig Rodrigues <rodrigc@mediaone.net>
To: Steven Belbin <steven.belbin@sympatico.ca>
Cc: gcc-gnats@gcc.gnu.org, xavier.oriol@delta-tek.com, nobody@gcc.gnu.org,
steven.belbin@delta-tek.com, rodrigc@mediaone.net
Subject: Re: c++/1843
Date: Sun, 18 Feb 2001 20:09:53 -0500
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hi,
I am merely a volunteer, trying to help the GCC project by
addressing some of their bug reports. I am not a doctor. :)
Tested your: gcc_bug_1843.cpp with:
gcc version 3.0 20010217 (prerelease)
The example compiled without error.
Running the example did not result in a coredump but in:
`§@`§@ a fatal error.
Look very carefully at your example. You
are creating a fatal_error on the stack. The scope of the
fatal_error is within the try block. By the time the call
stack is unwound and the program enters the catch() block,
the destructors for error and fatal_error have been called.
The fact that your program does not coredump is pure luck...There
is no reason for it not to, and the fact that it works on other
compilers is also pure luck.
I have attached your test case with print statements in the destructors.
Since this is not a compiler bug, I would like to close this
bug report.
For general questions about the design of exception classes,
I advise you to post to the Usenet newsgroup:
comp.lang.c++.moderated.
Thanks.
--
Craig Rodrigues
http://www.gis.net/~craigr
rodrigc@mediaone.net
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="1843.cpp"
#include <string.h>
#include <iostream.h>
char * StringAllocate( const char * text )
{
int size = ( text ) ? strlen( text ) : 0;
char * result = new char [ size + 1 ];
if ( text )
strncpy( result , text , size );
result[ size ] = '\0';
return result;
}
class error
{
private:
char * m_text;
public:
error() :
m_text( StringAllocate( NULL ) )
{}
error( const char * text ) :
m_text( StringAllocate( text ) )
{}
virtual ~error()
{ delete [] m_text;
cout << "Destructing error" << endl;
}
const char * text() const
{ return m_text; }
};
ostream & operator <<( ostream & output , const error & err )
{
return output << err.text();
}
class fatal_error :
virtual public error
{
public:
fatal_error()
{}
fatal_error( const char * text ) :
error( text )
{}
virtual ~fatal_error()
{ cout << "Destructing fatal error" << endl; }
};
int main( int argc , char * argv[] )
{
try
{
throw fatal_error( "Throwing a fatal error." );
}
catch( const error & err )
{
cerr << endl << err << endl;
}
return 0;
}
--ew6BAiZeqk4r7MaW--
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-04-01 0:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-01 0:00 libstdc++/501 neil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).