https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122835

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Regarding asm goto, I don't see that documented anywhere, anyway, gcc has
behaved that way forever.
Anyway, unlike computed goto/longjmp, I think asm goto is at least in theory
changeable, the question is if we do want that.
In e.g.
struct S { S (); ~S (); };

void
foo (int x)
{
  {
    S s;
    if (x == 1)
      goto l1;
    asm goto ("" : : : : l2);
  }
  l1:;
  l2:;
}
it is the eh pass which changes following 2 lines in:
          // predicted unlikely by goto predictor.
          goto l1;
...
        }
      finally
        {
          S::~S (&s);
        }
    }
  finally
    {
      s = {CLOBBER(eos)};
    }
  l1:
to
  // predicted unlikely by goto predictor.
  goto <D.3002>;
...
  <D.3002>:
  S::~S (&s);
  goto <D.3005>;
...
  <D.3005>:
  s = {CLOBBER(eos)};
  goto l1;
So, supposedly we could do the same from asm goto, change the label to an
artificial label which handles the needed cleanups on the way out.

Reply via email to