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

--- Comment #10 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Linus Torvalds from comment #9)
> (In reply to Jakub Jelinek from comment #8)
> > 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.
> 
> So we fixed this for this in the kernel, where we just make the "asm goto"
> go to a local label, and then that local label does a real goto. Then we
> just depend on the compiler doing the obvious branch following.
FTR, the testcase from Comment #0 should be changed to:

--cut here--
extern void exit (int);

static void my_cleanup (int *p)
{
  exit (0);
}

int main ()
{
  {
    int foo __attribute__((cleanup (my_cleanup))) = 0;

    asm goto("jmp %l0" :::: __after);

    if (0)
      {
      __after:
        goto after;
      }
  }

 after:
  __builtin_abort ();
}
--cut here--

Reply via email to