C++ exception handling : impacted by gcc optimizaton level?



 DEVELOP > c-Plus-Plus > C++ exception handling : impacted by gcc optimizaton level?

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: ""
Date: 19 May 2005 09:25:44 PM
Object: C++ exception handling : impacted by gcc optimizaton level?
Hi,
I am using gcc3.2.3 on Red Hat Linux. I just find a strange thing of
exception handling:if I compile the code in debug level, then the
exception can be caught; if I compile it in optimized level , then the
exception can not be caught.
The compile option for debug is
-c -DUNIX -fexceptions -g3 -DDEBUG -DLIN
The compile option for optimize is
-c -DUNIX -fexceptions -O3 -DNDEBUG -DLIN
Basically here is the code,
====== On the Top =====================
try{
... some function calls ...
}
catch (...){
printf("Caught...\n");
return 1;
}
====== Deep in the code ================
if (...some condition...){
printf("To throw...\n");
throw 1;
}
When I run in debug mode, I can see
To throw...
Caught...
But in optimized mode, I can only see
To throw...
Aborted.
then software crashes.
Is this a known problem?
.

User: "Kai-Uwe Bux"

Title: Re: C++ exception handling : impacted by gcc optimizaton level? 19 May 2005 09:43:21 PM
wrote:

Hi,
I am using gcc3.2.3 on Red Hat Linux. I just find a strange thing of
exception handling:if I compile the code in debug level, then the
exception can be caught; if I compile it in optimized level , then the
exception can not be caught.

[snip]

Is this a known problem?

Maybe, who knows? Wait, maybe those folks over there at the gcc mailing
lists know. After all that's very much on topic *there*.
Best
Kai-Uwe Bux
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER