public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8026: -fstack-check dumps when throw out of scope with ostringstream
@ 2002-09-24 17:16 Adam Fanello
0 siblings, 0 replies; only message in thread
From: Adam Fanello @ 2002-09-24 17:16 UTC (permalink / raw)
To: 'gcc-gnats@gcc.gnu.org'; +Cc: Glen Knowles
>Number: 8026
>Category: c++
>Synopsis: -fstack-check dumps when throw out of scope with
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Tue Sep 24 17:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: afanello@centor.com
>Release: 3.2
>Organization:
>Environment:
System: HP-UX hp11 B.11.00 U 9000/800 813839606 unlimited-user license
host: hppa2.0n-hp-hpux11.00
build: hppa2.0n-hp-hpux11.00
target: hppa2.0n-hp-hpux11.00
configured with: ./configure : (reconfigured) ./configure : (reconfigured)
./configure : (reconfigured) ./configure : (reconfigured) ./configure :
(reconfigured) ./configure : (reconfigured) ./configure : (reconfigured)
./configure : (reconfigured) ./configure : (reconfigured) ./configure :
(reconfigured) ./configure
>Description:
Throwing out of a scope which contains a std::ostringstream when the program
was compiled with the -fstack-check option causes a SIGSEGV while unwinding
the stack.
>How-To-Repeat:
Source program: ctcore.cpp
---------------------------------------------------------------------------
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, const char** argv, const char** envp)
{
try
{
ostringstream msg;
throw 0;
}
catch (int ex)
{
cout << "Caught exception" << endl;
}
cout << "End program." << endl;
return 0;
}
--------------------------------------------------------------------------
$ g++ -fstack-check ctcore.cpp
$ ./a.out
Segmentation fault (core dumped)
$
>Fix:
Workaround: Don't use -fstack-check
------_=_NextPart_001_01C26428.3261B9D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>-fstack-check dumps when throw out of scope with =
ostringstream</TITLE>
</HEAD>
<BODY>
<BR>
<P><FONT SIZE=3D2>>Submitter-Id: net</FONT>
<BR><FONT SIZE=3D2>>Originator: =
afanello@centor.com</FONT>
<BR><FONT SIZE=3D2>>Organization: </FONT>
<BR><FONT SIZE=3D2>>Confidential: no</FONT>
<BR><FONT SIZE=3D2>>Synopsis: =
-fstack-check dumps when throw out of scope with ostringstream</FONT>
<BR><FONT SIZE=3D2>>Severity: =
serious</FONT>
<BR><FONT SIZE=3D2>>Priority: =
medium</FONT>
<BR><FONT SIZE=3D2>>Category: =
c++</FONT>
<BR><FONT SIZE=3D2>>Class: =
wrong-code</FONT>
<BR><FONT SIZE=3D2>>Release: =
3.2</FONT>
<BR><FONT SIZE=3D2>>Environment:</FONT>
<BR><FONT SIZE=3D2>System: HP-UX hp11 B.11.00 U 9000/800 813839606 =
unlimited-user license</FONT>
</P>
<BR>
<P> =20
<BR><FONT SIZE=3D2>host: hppa2.0n-hp-hpux11.00</FONT>
<BR><FONT SIZE=3D2>build: hppa2.0n-hp-hpux11.00</FONT>
<BR><FONT SIZE=3D2>target: hppa2.0n-hp-hpux11.00</FONT>
<BR><FONT SIZE=3D2>configured with: ./configure : (reconfigured) =
./configure : (reconfigured) ./configure : (reconfigured) =
./configure : (reconfigured) ./configure : (reconfigured) =
./configure : (reconfigured) ./configure : (reconfigured) =
./configure : (reconfigured) ./configure : (reconfigured) =
./configure : (reconfigured) ./configure </FONT></P>
<P><FONT SIZE=3D2>>Description:</FONT>
<BR><FONT SIZE=3D2>Throwing out of a scope which contains a =
std::ostringstream when the program</FONT>
<BR><FONT SIZE=3D2>was compiled with the -fstack-check option causes a =
SIGSEGV while unwinding</FONT>
<BR><FONT SIZE=3D2>the stack.</FONT>
</P>
<P><FONT SIZE=3D2>>How-To-Repeat:</FONT>
</P>
<P><FONT SIZE=3D2>Source program: ctcore.cpp</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
------------</FONT>
<BR><FONT SIZE=3D2>#include <iostream></FONT>
<BR><FONT SIZE=3D2>#include <sstream></FONT>
</P>
<P><FONT SIZE=3D2>using namespace std;</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>
<P><FONT SIZE=3D2>int main(int argc, const char** argv, const char** =
envp)</FONT>
<BR><FONT SIZE=3D2>{</FONT>
<BR><FONT SIZE=3D2> try</FONT>
<BR><FONT SIZE=3D2> {</FONT>
<BR> <FONT SIZE=3D2> =
ostringstream msg;</FONT>
<BR> <FONT SIZE=3D2> =
throw 0;</FONT>
<BR><FONT SIZE=3D2> }</FONT>
<BR><FONT SIZE=3D2> catch (int ex)</FONT>
<BR><FONT SIZE=3D2> {</FONT>
<BR><FONT SIZE=3D2> cout << =
"Caught exception" << endl;</FONT>
<BR><FONT SIZE=3D2> }</FONT>
</P>
<P><FONT SIZE=3D2> cout << "End =
program." << endl;</FONT>
<BR><FONT SIZE=3D2> return 0;</FONT>
<BR><FONT SIZE=3D2>}</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
-----------</FONT>
</P>
<P><FONT SIZE=3D2>$ g++ -fstack-check ctcore.cpp</FONT>
<BR><FONT SIZE=3D2>$ ./a.out</FONT>
<BR><FONT SIZE=3D2>Segmentation fault (core dumped)</FONT>
<BR><FONT SIZE=3D2>$</FONT>
</P>
<P><FONT SIZE=3D2>>Fix:</FONT>
<BR> <FONT =
SIZE=3D2>Workaround: Don't use -fstack-check</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C26428.3261B9D0--
>Release-Note:
>Audit-Trail:
>Unformatted:
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C26428.3261B9D0
Content-Type: text/plain;
charset="iso-8859-1"
ostringstream
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-09-25 0:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-24 17:16 c++/8026: -fstack-check dumps when throw out of scope with ostringstream Adam Fanello
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).