* src/SDCCast.c (createDo): backPatchLabels() needs falseLabel in empty 'while'-loop...
[fw/sdcc] / src / SDCCast.c
index 99582eef1a7bb8de13b71da86192976697a70a78..def33ed0f4a15f5cd781f808c3b75a666bda0993 100644 (file)
@@ -5148,11 +5148,13 @@ createDo (symbol * trueLabel, symbol * continueLabel,
   /* if the body does not exist then it is simple */
   if (!doBody)
     {
-      condAst = backPatchLabels (condAst, continueLabel, NULL);
+      condAst = backPatchLabels (condAst, continueLabel, falseLabel);
       doTree = (IS_IFX (condAst) ? createLabel (continueLabel, condAst)
                 : newNode (IFX, createLabel (continueLabel, condAst), NULL));
       doTree->trueLabel = continueLabel;
       doTree->falseLabel = NULL;
+
+      doTree = newNode (NULLOP, doTree, createLabel (falseLabel, NULL));
       return doTree;
     }