* Re: exception handling bug in b18 g++
@ 1997-07-29 7:32 Wei Ku
0 siblings, 0 replies; 2+ messages in thread
From: Wei Ku @ 1997-07-29 7:32 UTC (permalink / raw)
To: scarlet, gnu-win32 Mailing List
Can g++ treat 'exception handling' correctly ? I thought it can not even in
UNIX machine.
Sincerely,
Wei Ku
***************************************
Department of Physics and Astronomy
The University of Tennessee
1408 Circle Drive
Knoxville, Tennessee 37996-1200
weiku@utkux.utcc.utk.edu
---------------------------------------
Solid State Division
Oak Ridge National Laboratory
P.O.Box 2008
Oak Ridge, TN 37831-6032
Phone: (423) 574-5795
Fax: (423) 574-4143
weiku@solid.ssd.ornl.gov
***************************************
-----Original Message-----
From: Benjamin Sean Scarlet <scarlet@mit.edu>
To: gnu-win32 Mailing List <gnu-win32@cygnus.com>
Date: Tuesday, July 29, 1997 8:34 AM
Subject: exception handling bug in b18 g++
>I seem to have found some odd bug in exception handling: after
>a catch block in a member function, the this pointer is corrupted:
>
>--------------------------test.C------------------------------------
>#include <iostream.h>
>
>class X
>{
> int x;
>public:
> void foo();
>};
>
>void printit(void *p)
>{
> cerr << p << endl;
>}
>
>void X::foo()
>{
> printit(this);
> try
>
> printit(this);
> throw 1;
> }
> catch(int)
> {
> printit(this);
> }
> printit(this);
>}
>
>main()
>{
> X x;
> x.foo();
>}
>----------------------------------------------------------------------
>When I try this, I get:
>
>bash$ g++ -fexceptions test.C -o test
>bash$ ./test
>0x241f464
>0x241f464
>0x241f464
>0x40c0f8
>
>As a side note, a possible quick fix is to turn on optimization:
>bash$ g++ -O -fexceptions test.C -o test
>bash$ ./test
>0x241f464
>0x241f464
>0x241f464
>0x241f464
>
> Benjamin Scarlet
> scarlet@mit.edu
>
>-----------------------------------------------------------------------
>Configuration particulars:
>Pentium II, Windows NT 4.0 (service pack 3)
>
>An even further aside: I don't know how extensive the Cygnus changes to
>the g++ exception handling code are, so I figured it wouldn't hurt to
>try this
>program on a Linux box with vanilla gcc-2.7.2.1: There I get no
>problem.
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 2+ messages in thread
* exception handling bug in b18 g++
@ 1997-07-28 23:31 Benjamin Sean Scarlet
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Sean Scarlet @ 1997-07-28 23:31 UTC (permalink / raw)
To: gnu-win32 Mailing List
I seem to have found some odd bug in exception handling: after
a catch block in a member function, the this pointer is corrupted:
--------------------------test.C------------------------------------
#include <iostream.h>
class X
{
int x;
public:
void foo();
};
void printit(void *p)
{
cerr << p << endl;
}
void X::foo()
{
printit(this);
try
{
printit(this);
throw 1;
}
catch(int)
{
printit(this);
}
printit(this);
}
main()
{
X x;
x.foo();
}
----------------------------------------------------------------------
When I try this, I get:
bash$ g++ -fexceptions test.C -o test
bash$ ./test
0x241f464
0x241f464
0x241f464
0x40c0f8
As a side note, a possible quick fix is to turn on optimization:
bash$ g++ -O -fexceptions test.C -o test
bash$ ./test
0x241f464
0x241f464
0x241f464
0x241f464
Benjamin Scarlet
scarlet@mit.edu
-----------------------------------------------------------------------
Configuration particulars:
Pentium II, Windows NT 4.0 (service pack 3)
An even further aside: I don't know how extensive the Cygnus changes to
the g++ exception handling code are, so I figured it wouldn't hurt to
try this
program on a Linux box with vanilla gcc-2.7.2.1: There I get no
problem.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-07-29 7:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-29 7:32 exception handling bug in b18 g++ Wei Ku
-- strict thread matches above, loose matches on Subject: below --
1997-07-28 23:31 Benjamin Sean Scarlet
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).