public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9588: memory fault when user throws exception from terminate()
@ 2003-02-05 19:46 fwang
  0 siblings, 0 replies; 4+ messages in thread
From: fwang @ 2003-02-05 19:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9588
>Category:       c++
>Synopsis:       memory fault when user throws exception from terminate()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 05 19:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Frank Wang
>Release:        gcc version 3.2
>Organization:
>Environment:
--enable-languages=c,c++,f77 
--prefix=/opt/cross --host=powerpc-suse-linux 
--target=powerpc64-linux 
--enable-threads=posix 
--disable-nls 
--enable-shared 
--with-headers=/usr/src/packages/BUILD/cross-ppc64-gcc-3.2/include-ppc64-glibc-2.2.5
>Description:
If user threw exception from terminate(), abort() function should be called. We used following codes to test this feathre by using 64bit g++, but got memory fault at running time
>How-To-Repeat:
Sample Source File: 
===================    
//tmp.cpp

using namespace std;
#include <exception>
struct S {
        int i;
        S() {i=1;}
};

void eh_term(void)
{
        S s;
        throw s;        
}

int main(void)
{
       set_terminate (&eh_term);

        try {
                throw 'a';      
        }
        catch (S) {
        }
        return 0;
}


Test Process:
=============
STEP1: compiling and linking

/opt/cross/bin/powerpc64-linux-g++ tmp.cpp

STEP2: run
a.out

Actual Output:
=============     
rc = 139
Error msg 
Memory fault

Expected Output:
=============== 
rc = 134
Error msg
Abort
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9588: memory fault when user throws exception from terminate()
@ 2003-02-06  4:56 Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2003-02-06  4:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9588; it has been noted by GNATS.

From: Alan Modra <amodra@bigpond.net.au>
To: fwang@ca.ibm.com
Cc: nathan@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/9588: memory fault when user throws exception from terminate()
Date: Thu, 6 Feb 2003 15:17:30 +1030

 I would guess that you have a library, most likely libc, built with
 a buggy toolchain that didn't terminate .eh_frame with a zero.  You
 can use a recent (later than 2002-11-04) version of readelf to
 display the terminator with something like
 
 powerpc64-linux-readelf --debug-dump=frames \
  /usr/local/powerpc64-linux/lib/libc.so.6 | grep ZERO
 
 which should result in
 
 xxxxxxxx ZERO terminator
 
 As far as I know, Jakub Jelinek fixed the toolchain problem 2002-04-22.
 
 -- 
 Alan Modra
 IBM OzLabs - Linux Technology Centre


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9588: memory fault when user throws exception from terminate()
@ 2003-02-05 21:56 fwang
  0 siblings, 0 replies; 4+ messages in thread
From: fwang @ 2003-02-05 21:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9588; it has been noted by GNATS.

From: fwang@ca.ibm.com
To: nathan@gcc.gnu.org, "Frank Wang" <fwang@ca.ibm.com>, gcc-bugs@gcc.gnu.org,
   gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9588: memory fault when user throws exception from terminate()
Date: Wed, 5 Feb 2003 16:52:25 -0500

 Hi,
 
 I think the real problem in calling terminate() function. according to
 Spec.15.1.8 and Spec.15.5
  If no exception is presently being handled, executing a throw-expression
 with no operand calls terminate() (15.5.1).
 
 If you try to compile and run following codes, you can get different result
 in 32bit gcc and 64bit gcc.
 
 //tmp.cpp
 #include <exception>
 struct S {
         int i;
         S() {i=1;}
 };
 
 int main(void)
 {
 
         try {
                 throw 'a';
         }
         catch (S) {
                 }
         return 0;
 }
 
 
 For 32bit gcc:   actual output: Abort
 For 64ibt gcc:   acutal output: Memory fault
 
 
 
 
 Regards,
 
 
 Frank Wang
 
 VisualAge C/C++ Compiler Test
 IBM Toronto Lab
 Phone:(905) 413 - 2337      TieLine: 969 - 2337
 Email: fwang@ca.ibm.com
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9588: memory fault when user throws exception from terminate()
@ 2003-02-05 20:15 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2003-02-05 20:15 UTC (permalink / raw)
  To: fwang, gcc-bugs, gcc-prs, nobody

Synopsis: memory fault when user throws exception from terminate()

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Wed Feb  5 20:15:56 2003
State-Changed-Why:
    not a bug. your program is ill formed. the terminat function
    shall terminate the program [18.6.3]

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9588


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-06  4:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-05 19:46 c++/9588: memory fault when user throws exception from terminate() fwang
2003-02-05 20:15 nathan
2003-02-05 21:56 fwang
2003-02-06  4:56 Alan Modra

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).