Mail Archives: djgpp/1999/02/27/06:13:30
--=====================_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 -