Bad code from egcs-1.1b

Jason Merrill jason@cygnus.com
Sun Oct 25 20:46:00 GMT 1998


I tracked this down.  The problem is that 

1) expand_fixup emits BLOCK_{BEGIN,END} notes to indicate where a cleanup
   should go, and then
2) expand_end_loop moves them to the beginning of the loop, and then
3) fixup_gotos expands the code for the cleanups into the wrong place.

Jeff, thoughts?

Here's a simpler testcase that can be run:

  typedef bool (*ftype) ();

  int c, d;
  struct A {
    A() { ++c; }
    A(const A&) { ++c; }
    ~A() { ++d; }
  };

  void f (ftype func)
  {
    A a;
    do {
      if ((*func)()) return;
    } while (true);
  }

  bool test ()
  {
    return true;
  }

  main ()
  {
    f (test);
    return (c != d);
  }



More information about the Gcc-bugs mailing list