delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/27/06:13:30

X-Authentication-Warning: web.mahe.ernet.in: mit AT web DOT mahe DOT ernet DOT in [202.141.20.66] didn't use HELO protocol
Message-Id: <3.0.5.32.19990227160208.0079c100@web.mahe.ernet.in>
X-Sender: mit AT web DOT mahe DOT ernet DOT in
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.5 (32)
Date: Sat, 27 Feb 1999 16:02:08 +0500
To: djgpp AT delorie DOT com
From: Manipal Institute of Technology <mit AT mahe DOT ernet DOT in>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

--=====================_920093528==_
Content-Type: text/plain; charset="us-ascii"


--=====================_920093528==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="1.txt"


I'd like to report 2 bugs (using c++) I found in DJGPP's GCC

1.    class X {
         typedef void (X::*func)();
      };

Compile the above with -g. It gives some errors in the assembler because
the symbol X::func gets into the assembler file. For me, debugging support
is very impt. so I gotta work around with complex defns. coz typedef dosent
work.


2.  Well, this is not very much a bug if c++ support is broken but
nevertheless the behaviour is kinky.


int main() {
  try {
    throw 1;
  }
  catch (...) {
    fprintf (stderr, "\nGot caught!");
  }
}

First, to compile this, we have to use -fhandle-exceptions. GCC complains
of undefined reference to terminate().

Okay, so define function terminate() before main() like this.

void terminate() {fprintf(stderr, "\nGot terminated!");}

Now compile with -O0 through -O2. Works correctly. Compile with -O3.
The catch handler is not entered at all! C's abort() function gets called.
Now remove the catch handler and compile with -O0 through -O3. In all cases,
terminate() does not get called!. (Again, abort() gets called).

Workaround for this is to simply install another catch handler along with
the default catch handler either before or after it. (preferably afterwards
so it never gets exec'ed).
Like this.

int main() {
  try {
    throw 1;
  }
  catch (...) {
    fprintf (stderr, "\nGot caught!");
  }
  catch(int) {}
}

And redefine abort() this way.

extern "C" {void abort() {terminate(); exit(1);}


Please note that I'm not a member of mailing list and cant access the
newsgroup. Please email to mit AT mahe DOT ernet DOT in with "TO CHIRAYU" prominantly
in the subject and the beginning of the email body else I wont even know
I got a reply.


Bye,
Chirayu.



--=====================_920093528==_
Content-Type: text/plain; charset="us-ascii"



--=====================_920093528==_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019