[Bug tree-optimization/106663] New: FSM threading doesn't handle computed goto
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 17 09:22:05 GMT 2022
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);
}
More information about the Gcc-bugs
mailing list