Exception Handling Bug with Purify

Dan A. Dickey ddickey@wamnet.com
Fri Jan 8 09:42:00 GMT 1999


Well, here's a script of a little session.
Something about the exception handling is causing purify (4.2) to
make the program die.  Without purify, exceptions are handled
nicely - with it, there are a few ABR and then an MSE
followed by a COR.  This is on a Sun ultrasparc with Solaris
2.5.1.  Any ideas about this one?  This is simple to reproduce
here - and is happening with both gcc 2.8.1, and egcs 1.1.1.
Help!  Please...  :)        -Dan

fizban$ cat typescript
Script started on Fri Jan 08 11:30:18 1999
$ cat break.cc
#include <iostream.h>

class t {
public:
        t() throw(int);
private:
        int i;
};

t::t() throw(int)
{
        int     j = 1;

        if (1)
                throw j;
}

main(int ac, char **av)
{
        t       *tp;

        cout << "Get ready...";

        try {
                tp = new t;
        }
        catch (...) {
                cout << "exception caught";
        }
        cout << "\n";

        exit(0);
}
$ g++ -v
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
$ g++ break.cc
$ ./a.out
Get ready...exception caught
$ purify g++ break.cc
Purify 4.2 Solaris 2, Copyright (C) 1992-1998 Rational Software Corp.
All rights reserved.
Instrumenting: cchA53eL.o  Linking
g++: file path prefix `/usr/pure/purify-4.2-solaris2/nld/' never used
$ unset DISPLAY
$ ./a.out
****  Purify instrumented ./a.out (pid 4287 at Fri Jan  8 11:30:53 1999)

  * Purify 4.2 Solaris 2, Copyright (C) 1992-1998 Rational Software
Corp. All rights reserved.
  * For contact information type: "purify -help"
  * For Purify Viewer output, set the DISPLAY environment variable.
  * Command-line: ./a.out
  * Options settings: -g++=yes -purify \
    -purify-home=/usr/pure/purify-4.2-solaris2
  * Purify licensed to Wam!Net Inc.
  * Purify checking enabled.

****  Purify instrumented ./a.out (pid 4287)  ****
ABR: Array bounds read:
  * This is occurring while in:
        count_fdes     [frame.c]
        find_fde       [frame.c]
        __frame_state_for [frame.c]
        __throw        [libgcc2.c]
        t::t()         [cchA53eL.o]
        main           [cchA53eL.o]
  * Reading 4 bytes from 0xac438 in the initialized data section.
  * Address 0xac438 is global variable "__EH_FRAME_BEGIN__".
    This is defined in a.out.

****  Purify instrumented ./a.out (pid 4287)  ****
ABR: Array bounds read:
  * This is occurring while in:
        count_fdes     [frame.c]
        find_fde       [frame.c]
        __frame_state_for [frame.c]
        __throw        [libgcc2.c]
        t::t()         [cchA53eL.o]
        main           [cchA53eL.o]
  * Reading 4 bytes from 0xac43c in the initialized data section.
  * Address 0xac43c is 4 bytes past start of global variable
"__EH_FRAME_BEGIN__".
    This is defined in a.out.

****  Purify instrumented ./a.out (pid 4287)  ****
ABR: Array bounds read:
  * This is occurring while in:
        count_fdes     [frame.c]
        find_fde       [frame.c]
        __frame_state_for [frame.c]
        __throw        [libgcc2.c]
        t::t()         [cchA53eL.o]
        main           [cchA53eL.o]
  * Reading 4 bytes from 0xac438 in the initialized data section.
  * Address 0xac438 is global variable "__EH_FRAME_BEGIN__".
    This is defined in a.out.

****  Purify instrumented ./a.out (pid 4287)  ****
ABR: Array bounds read:
  * This is occurring while in:
        count_fdes     [frame.c]
        find_fde       [frame.c]
        __frame_state_for [frame.c]
        __throw        [libgcc2.c]
        t::t()         [cchA53eL.o]
        main           [cchA53eL.o]
  * Reading 4 bytes from 0xac440 in the initialized data section.
  * Address 0xac440 is 8 bytes past start of global variable
"__EH_FRAME_BEGIN__".
    This is defined in a.out.

****  Purify instrumented ./a.out (pid 4287)  ****
MSE: Memory segment error:
  * This is occurring while in:
        count_fdes     [frame.c]
        find_fde       [frame.c]
        __frame_state_for [frame.c]
        __throw        [libgcc2.c]
        t::t()         [cchA53eL.o]
        main           [cchA53eL.o]
  * Accessing a memory range that crosses a memory segment boundary.
    Addressing 0x708036a1 for 4 bytes ending at 0x708036a5,
    which is neither in the heap nor the main stack.

****  Purify instrumented ./a.out (pid 4287)  ****
COR: Fatal core dump:
  * This is occurring while in:
        count_fdes     [frame.c]
        find_fde       [frame.c]
        __frame_state_for [frame.c]
        __throw        [libgcc2.c]
        t::t()         [cchA53eL.o]
        main           [cchA53eL.o]
  * Received signal 10 (SIGBUS - Bus Error)
  * Faulting address = 0x708036a1
  * Signal mask: (SIGBUS)
  * Pending signals:
Bus Error(coredump)
$
script done on Fri Jan 08 11:31:03 1999
fizban$


--
Dan A. Dickey
ddickey@wamnet.com






More information about the Gcc-bugs mailing list