Mail Archives: djgpp-workers/1998/10/22/03:00:33
Hi!
When I found problems with exceptions with DJGPP port of egcs-1.1
I tried to study more detailed what works and what fails.
I used for tests:
egcs-1.1:
native compiler for Linux (i586-pc-linux-gnulibc1)
native compiler for DJGPP (i386-pc-msdosdjgpp)
cross-compiler from Linux to DJGPP
egcs-2.92.16 19981019
native compiler for Linux
cross-compiler from Linux to DJGPP (it was more easy
for me to build cross-compiler than the native
one)
Here are some results:
with -fsjlj-exceptions : I was not able to get exceptions working
for both Linux and DJGPP and with stable release (egcs-1.1)
and with later development snapshot of egcs (egcs-2.92.16).
Only thing I get from throwing exception is SIGABRT
So it's seems that -fsjlj-exceptions is broken with egcs-1.1
and later snapshots
without -fsjlj-exceptions
Linux (i586-pc-linux-gnulibc1) and egcs-1.1 release
works. No evident problems
Linux (i586-pc-msdos-gnulibc1) and snapshot egcs-2.92.16
works when -fomit-frame-pointer is not specified
SIGABRT with -fomit-frame-pointer
DJGPP and egcs-1.1 release (both native compiler for DJGPP
and cross-compiler from Linux)
generally works but there are serious problems.
I have send messages about them egcs mailing list
and these problems are already discussed in djgpp
mailing lists
DJGPP and egcs-2.92.16 (cross-compiler from Linux only)
does not work at all. I'm getting only SIGABRT
DJGPP and gcc-2.8.1
works without problems.
Here is example I used for tests:
-----------------------------------------------------------
#include <iostream>
#include <string>
// Test example for exceptions problem with DJGPP port of egcs-1.1
// If the next line is uncommented all 4 exceptions are catched
//#define D(x) x
// If the next line is uncommented only first 3 exceptions are catched.
// The last one ends with abort
#define D(x)
// With gcc-2.8.1 both tests works Ok
class xx {};
class test
{
public:
string text;
test (const char * x) : text(x)
{
cout << "test::test(\"" << text << "\")\n";
}
~test ()
{
cout << "test::~test() : \"" << text << "\"\n";
}
};
void touch ( test & x ); /* Let's fool gcc to think this object is
really used */
void x1 (void) throw (xx)
{
D(test w1 ("void x1 (void) throw (xx)"));
D(touch (w1));
xx a;
throw(a);
}
void x2 (void)
{
D(test w2 ("void x2 (void)"));
D(touch (w2));
xx a;
// #ifdef __MSDOS__
// if (biostime(0,0L)!=0)
// #endif
throw(a);
return;
}
void x1a (void)
{
D(test w3 ("void x1a (void)"));
D(touch (w3));
x1 ();
}
void x1b (void) throw (xx)
{
D(test w3 ("void x1b (void)"));
D(touch (w3));
x1 ();
}
int main (void)
{
try { x1(); } catch (xx w) { cout << "catched from x1()\n"; }
cout << "----------------\n";
try { x1b(); } catch (xx w) { cout << "catched from x1b()\n"; }
cout << "----------------\n";
try { x1a(); } catch (xx w) { cout << "catched from x1a()\n"; }
cout << "----------------\n";
try { x2(); } catch (xx w) { cout << "catched from x2()\n"; }
cout << "----------------\n";
return 0;
}
void touch ( test & )
{
}
--------------------------------------------------------------
Andris
- Raw text -