LRH commit, only to sync with other developers
[fw/sdcc] / src / SDCCBBlock.c
index 9b809bed9cfbaca434bc1752508f9e7191917a96..dac9d8ec5ce3019245d2327fb0c88818da07628b 100644 (file)
@@ -102,8 +102,8 @@ FILE *appendDumpFile (int id) {
 
   if (!dumpFilesPtr->filePtr) {
     // not used before, create it
-    strcpy (scratchFileName, dstFileName);
-    strcat (scratchFileName, dumpFilesPtr->ext);
+    strncpyz (scratchFileName, dstFileName, PATH_MAX);
+    strncatz (scratchFileName, dumpFilesPtr->ext, PATH_MAX);
     if (!(dumpFilesPtr->filePtr = fopen (scratchFileName, "w"))) {
       werror (E_FILE_OPEN_ERR, scratchFileName);
       exit (1);
@@ -188,9 +188,11 @@ dumpEbbsToFileExt (int id, eBBlock ** ebbs, int count)
   for (i = 0; i < count; i++)
     {
       fprintf (of, "\n----------------------------------------------------------------\n");
-      fprintf (of, "Basic Block %s : loop Depth = %d noPath = %d , lastinLoop = %d\n",
+      fprintf (of, "Basic Block %s : loop Depth(lSeq) = %d(%d) noPath = %d , lastinLoop = %d\n",
               ebbs[i]->entryLabel->name,
               ebbs[i]->depth,
+              (0 /* for now */ &
+               ebbs[i]->depth) ? findLoopEndSeq(ebbs[i]->partOfLoop) : 0,
               ebbs[i]->noPath,
               ebbs[i]->isLastInLoop);
       fprintf (of, "\ndefines bitVector :");
@@ -226,7 +228,7 @@ iCode2eBBlock (iCode * ic)
     ebb->entryLabel = ic->argLabel.label;
   else
     {
-      sprintf (buffer, "_eBBlock%d", eBBNum++);
+      SNPRINTF (buffer, sizeof(buffer), "_eBBlock%d", eBBNum++);
       ebb->entryLabel = newSymbol (buffer, 1);
       ebb->entryLabel->key = labelKey++;
     }
@@ -419,6 +421,7 @@ addiCodeToeBBlock (eBBlock * ebp, iCode * ic, iCode * ip)
 void 
 remiCodeFromeBBlock (eBBlock * ebb, iCode * ic)
 {
+  wassert (ic->seq>=ebb->fSeq && ic->seq<=ebb->lSeq);
   if (ic->prev)
     ic->prev->next = ic->next;
   else