With gcc it is possible to store a label as a value and execute goto with that value, called a ‘computed goto.’
Information on this is available at http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
This is useful because in certain cases it enables you to remove all of the overhead of a switch statement by indexing the label addresses based on the argument to the switch, thus jumping directly to the code you want on a certain input.
When I attempt this with nvcc I get the following output.
Assertion failure at line 123 of …/…/be/opt/opt_lab.cxx:
Compiler Error in file /tmp/tmpxft_00002d90_00000000-7_vm.cpp3.i during Global Optimization – Mainopt Lowering phase:
Unexpected control transfer instruction !
I take it this means computed gotos are unsupported in nvcc. Is this impossible? Will it be added in the future? This sort of thing would be straightforward to implement directly in ptx, but I would prefer to avoid this.