public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/2723: exception handling
@ 2001-05-03  2:36 jle
  0 siblings, 0 replies; only message in thread
From: jle @ 2001-05-03  2:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2723
>Category:       c++
>Synopsis:       exception handling
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 03 02:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jacques Leroy
>Release:        gcc version 2.95.3 20010315 (release)
>Organization:
>Environment:
hppa2.0-hp-hpux10.20
(using gas 2.10.1)
>Description:
throwing an axception cause a Memory Fault

happens only on hppa2.0-hp-hpux10.20

Very nasty bug preventing CORBA-related product to work safely...
>How-To-Repeat:
class Ex() {
public:
Ex() {}
};

int main(int argc, char *argv[]) {
  try {
    throw Ex();
    return 1;
  } catch (const Ex& e) {
    return 0;
  } catch (...) {
    return 1;
  }
  return 1;
}
// this will crash in flame
>Fix:
// simply add include of std exception
#include <exception>

// derive from std::exception
class Ex() : public std::exception {
public:
Ex() {}
};

int main(int argc, char *argv[]) {
  try {
    throw Ex();
    return 1;
  } catch (const Ex& e) {
    return 0;
  } catch (...) {
    return 1;
  }
  return 1;
}

// and it's working !
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-03  2:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-03  2:36 c++/2723: exception handling jle

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