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

--- Comment #3 from Michael Matz <matz at gcc dot gnu.org> ---
For purposes of discussion, let's make a full example:

% cat ex.c
int get(int);
int foo (int a, int *ary)
{
  //void *labelsy[] = {&&lab1, &&lab2, &&lab3, &&lab_end};
  //int ary[] = {0, 1, 2, 3};
  int i = 0;
  int ret = 0;
  for (;;)
    switch (ary[i++]) {
        case 0:
            ret += get (1);
            break;
        case 1:
            ret += get (2);
            break;
        case 2:
            ret += get (3);
            break;
        case 3:
            goto after_loop;
        case 4:
            ret += get (4);
            break;
        case 34:
            ret += get (5);
            break;
        case 44:
            ret += get (6);
            break;
        case 46:
            ret += get (7);
            break;
        case 444:
            ret += get (8);
            break;
        case 124:
            ret += get (9);
            break;
        case 4321:
            ret += get (10);
            break;
    }
after_loop:
  return ret;
}

On at least x86-64 (with -O2) this is compiled to a table jump variant
for the switch.  What Nathans wants, I think (please correct), is that the
table jump sequence (in particular the indirect jump) be duplicated.

Reply via email to