L
linq936
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?
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?