Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > gcc3.2.3 : exception caught, but still segment fault

Reply
Thread Tools

gcc3.2.3 : exception caught, but still segment fault

 
 
linq936@hotmail.com
Guest
Posts: n/a
 
      05-18-2005
Hi,
I am using gcc3.2.3 as the compiler for my c++ code on Red Hat Linux
Enterprise 3. I find that even an exception is caught, "Segment Fault"
is still thrown out and program crashes.

Here is my code,
int func0(){
...
if (...some condition...){
throw MyException();
}
}

char* func(){
try{
...
func0();
}
catch (MyException& ){
cout << "Hey catch exception" << endl;
return NULL;
}
}

In running the code, I can see that "Hey catch exception", and then
"Segment Fault", it never returns to the caller of func().

Is this a known problem?

Thanks.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      05-18-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I am using gcc3.2.3 as the compiler for my c++ code on Red Hat Linux
> Enterprise 3. I find that even an exception is caught, "Segment Fault"
> is still thrown out and program crashes.
>
> Here is my code,
> int func0(){
> ...
> if (...some condition...){
> throw MyException();
> }
> }
>
> char* func(){
> try{
> ...
> func0();
> }
> catch (MyException& ){
> cout << "Hey catch exception" << endl;
> return NULL;
> }
> }
>
> In running the code, I can see that "Hey catch exception", and then
> "Segment Fault", it never returns to the caller of func().
>
> Is this a known problem?


How can it be answered if we don't know what 'MyException' is and how you
call the 'func' and what you do with the return value. Besides, the code
you posted contains instances of '...' which also can be the cause of the
faults.

BTW, not all control paths in 'func' have the 'return' statements.

Follow the recommendations in FAQ 5.8.

V
 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      05-18-2005
(E-Mail Removed) wrote:
> Hi,
> I am using gcc3.2.3 as the compiler for my c++ code on Red Hat Linux
> Enterprise 3. I find that even an exception is caught, "Segment Fault"
> is still thrown out and program crashes.
>
> Here is my code,
> int func0(){
> ...
> if (...some condition...){
> throw MyException();
> }
> }
>
> char* func(){
> try{
> ...
> func0();
> }
> catch (MyException& ){
> cout << "Hey catch exception" << endl;
> return NULL;
> }
> }
>
> In running the code, I can see that "Hey catch exception", and then
> "Segment Fault", it never returns to the caller of func().
>
> Is this a known problem?
>
> Thanks.
>


I had a similar problem. By any chance do you have MATLAB installed?

Note: Followup set to gnu.g++.help, since this is OT for c.l.c++.
Please continue reading this thread there.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception of type 'System.Web.HttpUnhandledException' wasthrown.Exception has been thrown by the target of an invocation.System.WebSystem.Exception jobs ASP .Net 1 11-16-2007 05:57 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Segment fault with pointer to method Juggernaut C Programming 3 04-11-2005 09:32 PM
matching the network segment but can't work :-( Facco Eloelo Perl Misc 2 07-30-2004 12:21 PM
Stack fault and page fault help S.Flournoy Computer Support 2 04-17-2004 04:23 PM



Advertisments