public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andris Pavenis <pavenis@lanet.lv>
To: djgpp-workers@delorie.com, egcs@cygnus.com
Subject: egcs and exceptions
Date: Thu, 22 Oct 1998 05:46:00 -0000	[thread overview]
Message-ID: <Pine.A32.3.91.981022102148.50968A-100000@ieva06.lanet.lv> (raw)

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


             reply	other threads:[~1998-10-22  5:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-22  5:46 Andris Pavenis [this message]
1998-10-30  3:25 ` Alexandre Oliva
1998-10-30 14:39   ` Mumit Khan
     [not found] ` <orpvbbt1mq.fsf.cygnus.egcs@araguaia.dcc.unicamp.br>
1998-10-31  2:52   ` Jason Merrill
1998-10-31  5:02     ` Alexandre Oliva
1998-11-02 22:42       ` Jason Merrill
1998-11-03  6:36         ` Alexandre Oliva
1998-11-04  2:20 Klaus-Georg Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.A32.3.91.981022102148.50968A-100000@ieva06.lanet.lv \
    --to=pavenis@lanet.lv \
    --cc=djgpp-workers@delorie.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).