Can a label be listed multiple times in indirectbr?
Clang generates this:
foo: ; preds =
%indirectgoto, %indirectgoto, %indirectgoto, %indirectgoto, %indirectgoto
  store i32 1, i32* %retval
  br label %return
indirectbr i8* %indirect.goto.dest, [label %foo, label %foo, label %bar,
label %foo, label %hack, label %foo, label %foo]
For this code taken from the gcc manual:
....
     static const int array = { &&foo - &&foo, &&bar - &&foo,
                                  &&hack - &&foo };
     goto *(&&foo + array[i]);
.....
If I remove &&foo - &&foo from the array, clang still thinks that &&foo
is a possible destination, even if I run some optimizers on it.
Since the argument to goto is an array of constants, it should be
possible for an optimizer to determine the exact list of destinations.
Also the intent of that code is to allow it to go into a readonly
section, however with Clang it only goes to a .data.rel.ro section (with
-fPIC):
        .section .data.rel.ro,"aw",@progbits
        .align 4
foo.array:
        .long (.LBA3_foo_return) - (.LBA3_foo_return)
        .long (.LBA3_foo_bar) - (.LBA3_foo_return)
        .long (.LBA3_foo_hack) - (.LBA3_foo_return)
        .size foo.array, 12
While gcc does put it into a readonly section (with -fPIC):
        .section .rodata
        .align 4
        .type array.1248, @object
        .size array.1248, 12
array.1248:
        .long 0
        .long .L4-.L2
        .long .L5-.L2
Best regards,
--Edwin