https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106663
Bug ID: 106663 Summary: FSM threading doesn't handle computed goto Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- For the following B->C isn't threaded but it seems the code is/was halfway there. With ranger we won't ever get &C as range for the goto destination though, so whether the thread copier handles things correctly is unknown. unsigned g; void FSM (int start) { void *states[] = { &&A, &&B, &&C, &&E }; void *state = states[start]; do { goto *state; A: g += 1; state = g & 1 ? &&B : &&E; continue; B: g += 2; state = &&C; continue; C: g += 3; state = states[g & 3]; continue; E: break; } while (1); }