* gcc3.2.3 exception handling : impacted by gcc optimizaton level?
@ 2005-05-20 2:25 lin q
2005-05-20 11:45 ` Eljay Love-Jensen
0 siblings, 1 reply; 2+ messages in thread
From: lin q @ 2005-05-20 2:25 UTC (permalink / raw)
To: gcc-help
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?
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gcc3.2.3 exception handling : impacted by gcc optimizaton level?
2005-05-20 2:25 gcc3.2.3 exception handling : impacted by gcc optimizaton level? lin q
@ 2005-05-20 11:45 ` Eljay Love-Jensen
0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2005-05-20 11:45 UTC (permalink / raw)
To: lin q, gcc-help
Hi lin q,
Try these flags:
-c -DUNIX -fexceptions -g3 -O3 -DDEBUG -DLIN
GCC can optimize & have debug code.
HTH,
--Eljay
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-20 11:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-20 2:25 gcc3.2.3 exception handling : impacted by gcc optimizaton level? lin q
2005-05-20 11:45 ` Eljay Love-Jensen
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).