Bug in throw() function suffix?

Andris Pavenis pavenis@lanet.lv
Sat Oct 31 07:28:00 GMT 1998


Subject:        	Re: Bug in throw() function suffix?
From:           	Alexandre Oliva <oliva@dcc.unicamp.br>
Date sent:      	31 Oct 1998 06:26:40 -200

> Andris Pavenis <pavenis@lanet.lv> writes:
> 
> > YAKUSH S E <yakush@ipmnet.ru> writes:
> >> 
> >> > I came across a strange bug(?) in egcs-1.1 (pgcc-2.91.57 19980901):
> >> 
> >> Using the *real* egcs (pgcc is not egcs) does not cause the program to 
> >> abort() on x86.  Please submit a bug report to the pgcc maintenance
> >> team.
> 
> > Tested with both egcs-1.1 and pgcc-1.1 
> > (GNU C++ version pgcc-2.91.57 19980901 (egcs-1.1 release) (djgpp) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).) 
> > for DJGPP. 
> 
> Ok, AFAIK, DJGPP enables -fsjlj-exceptions by default.  Unfortunately, 
> to the best of my knowledge, exception verifications in sjlj-exceptions
> are broken :-(

No DJGPP does not use -fsjlj-exceptions by default. There were discussions
about this topic when gcc-2.8.0 were ported as at that time -fexceptions
support were missing. That were fixed later when port of gcc-2.8.1 were
released. So there were no special need to use -fsjlj-exceptions other
than trying to see whether it works as there were regressions with
-fexceptions against gcc-2.8.1: I didn't find problems with gcc-2.8.1, but
with egcs in some conditions exceptions are not cought.

I did some more tests with egcs-1.1 release (DJGPP)

Question: how exceptions work on systems that similary as DJGPP uses
COFF format. I simply don't have access to different one. Maybe these
problems are COFF related.

> I've just added the attached testcase to the testsuite.
Ok

I'm including test example I used in attachment.
 
Short summary of some tests:
---------------------------------------------------

gcc -fomit-frame-pointer -fexceptions -O2 xxx.cc -lstdcxx -o xxx.exe

    #define D(x)
    DJGPP:   All 4 exceptions were cought
    Linux:   Abort on 3th throw

    #define D(x) (x)   /* It is there is local objects to destroy */
    DJGPP:   
C:\TMP>xxx.exe
test::test("void x1 (void) throw (xx)")
test::~test() : "void x1 (void) throw (xx)"
catched from x1()
----------------
test::test("void x1b (void)")
test::test("void x1 (void) throw (xx)")
test::~test() : "void x1 (void) throw (xx)"
test::~test() : "void x1b (void)"
catched from x1b()
----------------
test::test("void x1a (void)")
test::test("void x1 (void) throw (xx)")
test::~test() : "void x1 (void) throw (xx)"
test::~test() : "void x1a (void)"
Abort!

    Linux:   Abort on 3th throw

gcc -fexceptions -O2 xxx.cc -lstdcxx -o xxx.exe

    #define D(x)
    DJGPP:   Abort on last throw
    Linux:   Works OK

    #define D(x) (x)
    DJGPP:   Works OK
    Linux:   Works OK	 

--------------------------------------------------------------------------
C:\TMP>gcc -fomit-frame-pointer -fsjlj-exceptions -O2 xxx.cc -lstdcxx -o 
xxx.exe
C:\TMP>xxx.exe
test::test("void x1 (void) throw (xx)")
test::~test() : "void x1 (void) throw (xx)"
Abort!
Exiting due to signal SIGABRT
Raised at eip=000175a6
eax=000ae220 ebx=00000120 ecx=00000000 edx=00015500 esi=000ae4a4 
edi=000ae3c4
ebp=000ae2cc esp=000ae21c program=C:\TMP\XXX.EXE
cs: sel=00af  base=830a5000  limit=000bffff
ds: sel=00b7  base=830a5000  limit=000bffff
es: sel=00b7  base=830a5000  limit=000bffff
fs: sel=008f  base=00015500  limit=0000ffff
gs: sel=00c7  base=00000000  limit=0010ffff
ss: sel=00b7  base=830a5000  limit=000bffff
App stack: [000ae748..0002e748]  Exceptn stack: [0002e624..0002c6e4]

Call frame traceback EIPs:
  0x000174c8   ___djgpp_traceback_exit+48
  0x000175a6   _raise+94
  0x0001698f   _abort+27
  0x00011db0   ___terminate, line 0 of libgcc2.c
  0x00011dba   ___terminate+10, line 0 of libgcc2.c
  0x00012480   ___throw+428, line 0 of libgcc2.c
  0x00012861   ___check_eh_spec+61, line 0 of exception.cc
  0x000018c7   _x1__Fv+807
  0x00002212   _main+78
  0x00014a82   ___crt1_startup+174


C:\TMP>cc -fsjlj-exceptions -O2 xxx.cc -lstdcxx -o xxx.exe

C:\TMP>xxx.exe
test::test("void x1 (void) throw (xx)")
test::~test() : "void x1 (void) throw (xx)"
Abort!
Exiting due to signal SIGABRT
Raised at eip=00017582
eax=000ae220 ebx=00000120 ecx=00000000 edx=00015500 esi=000ae4a4 
edi=000ae3c4
ebp=000ae2cc esp=000ae21c program=C:\TMP\XXX.EXE
cs: sel=00af  base=830a5000  limit=000bffff
ds: sel=00b7  base=830a5000  limit=000bffff
es: sel=00b7  base=830a5000  limit=000bffff
fs: sel=008f  base=00015500  limit=0000ffff
gs: sel=00c7  base=00000000  limit=0010ffff
ss: sel=00b7  base=830a5000  limit=000bffff
App stack: [000ae748..0002e748]  Exceptn stack: [0002e624..0002c6e4]

Call frame traceback EIPs:
  0x000174a4   ___djgpp_traceback_exit+48
  0x00017582   _raise+94
  0x0001696b   _abort+27
  0x00011d8c   ___terminate, line 0 of libgcc2.c
  0x00011d96   ___terminate+10, line 0 of libgcc2.c
  0x0001245c   ___throw+428, line 0 of libgcc2.c
  0x0001283d   ___check_eh_spec+61, line 0 of exception.cc
  0x000018c7   _x1__Fv+807
  0x0000220e   _main+78
  0x00014a5e   ___crt1_startup+174

-----------------------------------------------------------------------
Andris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xxx.cc
Type: text/x-c++
Size: 1694 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/19981031/4558f3da/attachment.bin>


More information about the Gcc-bugs mailing list