- CodeEntry* X = NewCodeEntry (E->OPC, E->AM, N->Arg, N->JumpTo, E->LI);
+ CodeEntry* X;
+ CodeLabel* LN = N->JumpTo;
+
+ if (LN != 0 && LN->Owner == N) {
+
+ /* We found a jump to a jump to itself. Replace our jump
+ * by a jump to itself.
+ */
+ CodeLabel* LE = CS_GenLabel (S, E);
+ X = NewCodeEntry (E->OPC, E->AM, LE->Name, LE, E->LI);
+
+ } else {
+
+ /* Jump to the final jump target */
+ X = NewCodeEntry (E->OPC, E->AM, N->Arg, N->JumpTo, E->LI);
+
+ }