exceptions and cross jump optimization

Jeffrey A Law law@cygnus.com
Sat Oct 31 01:21:00 GMT 1998


  In message <41256616.005D8273.00@dbogw2-e1.esb.eur.deuba.com>you write:
  > Following programm gives different output if compiled with -O0 or -O1.
  > 
  > /* cross jump optimization bug */
  > 
  > #include <stdio.h>
  > #include <string.h>
  > 
  > class A {
  > public:
  >     virtual void throw_exception();
  >     void xxx(char * sz);
  > };
  > 
  > void A::throw_exception() { throw 1; }
  > 
  > void A::xxx(char * sz) {
  >     if (strcmp(sz, "xxx") == 0) {
  >         try {
  >             throw_exception();
  >             return;
  >         }
  >         catch (int n) { }
  >     }
  >     else {
  >         throw_exception();
  >         return;
  >     }
  > }
  > 
  > int  main(void) {
  >     A a;
  >     int fOk = 1;
  >     try {
  >         a.xxx("xxx");
  >     }
  >     catch (int n) {
  >         fOk = 0;
  >     }
  >     printf(fOk != 0 ? "Ok\n" : "Wrong\n");
  > }
  > 
This bug has been fixed for egcs-1.1.1.

jeff



More information about the Gcc-bugs mailing list