public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8070: Gcc [ throw generate core dump ( TRU64 5.1 ) ]
@ 2002-09-27  7:26 eric.thomas
  0 siblings, 0 replies; 2+ messages in thread
From: eric.thomas @ 2002-09-27  7:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8070
>Category:       c++
>Synopsis:       Gcc [ throw generate core dump ( TRU64 5.1 ) ]
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 27 07:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     eric.thomas@bull.net
>Release:        gcc 2.9-gnupro-99r1
>Organization:
>Environment:
Alpha DEC machine
TRU64 5.1
>Description:
throw generate a core dump.

Our code run uccefully under a Sun machine.
We use gcc on SUN with the same build options.

>How-To-Repeat:
On Dec machine:
Build the sample code and run it.

// #include <stdio.h>

class toto 
	{
	public:
	void printout(char * s );
	};


void toto::printout( char * s )
{
	// printf("Hello from printout\n");
	throw "throw from printout";
}


int main()
{
    char *buf;
    toto t;
    
    try
    {
        buf = new char[512];
//        throw ("Memory allocation failure!");
	t.printout("Hello");

    }
    catch( char * str )
    {
 //       printf("Exception raised: %s\n",str );
    }
    // ...
    return 0;
}

>Fix:

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


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

* Re: c++/8070: Gcc [ throw generate core dump ( TRU64 5.1 ) ]
@ 2002-09-27  9:30 pme
  0 siblings, 0 replies; 2+ messages in thread
From: pme @ 2002-09-27  9:30 UTC (permalink / raw)
  To: eric.thomas, gcc-bugs, gcc-prs, nobody

Synopsis: Gcc [ throw generate core dump ( TRU64 5.1 ) ]

State-Changed-From-To: open->closed
State-Changed-By: pme
State-Changed-When: Fri Sep 27 09:30:17 2002
State-Changed-Why:
    
    This is not a bug.  (The Sun compiler is wrong.)  You are
    throwing a string literal, which has type "const char *".
    You are catching only "char *".  Therefore the exception
    is not caught, and propogates off the stack, which calls
    terminate(), which calls abort(), which dumps core.
    
    Change the catch line to "catch (const char * str)"
    instead.

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


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

end of thread, other threads:[~2002-09-27 16:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-27  7:26 c++/8070: Gcc [ throw generate core dump ( TRU64 5.1 ) ] eric.thomas
2002-09-27  9:30 pme

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