Fix null pointer deref that caused build failures on Solaris
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 11 Apr 2003 16:12:29 +0000 (16:12 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 11 Apr 2003 16:12:29 +0000 (16:12 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2507 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCmem.c
src/ds390/gen.c
src/mcs51/gen.c

index 17a8859834d2ecc191d484da92da04eb583d0be0..6c5f0d87949cab378694c9c3b454d2d3894f05f4 100644 (file)
@@ -1083,9 +1083,12 @@ doOverlays (eBBlock ** ebbs, int count)
 void 
 printAllocInfo (symbol * func, FILE * of)
 {
+  if (!func)
+       return;
+    
   if (!of)
     of = stdout;
-
+    
   /* must be called after register allocation is complete */
   fprintf (of, ";------------------------------------------------------------\n");
   fprintf (of, ";Allocation info for local variables in function '%s'\n", func->name);
index ad5d8c4e5e61692862e1b9e9405406aeae15c40c..d417b07fc9afe1de751f7ed6112b74f7b547de3f 100644 (file)
@@ -12697,7 +12697,7 @@ gen390Code (iCode * lic)
   }
 #if 1
   /* print the allocation information */
-  if (allocInfo)
+  if (allocInfo && currFunc)
     printAllocInfo (currFunc, codeOutFile);
 #endif
   /* if debug information required */
index 9b28f9b4adbd710ec1ea58b666837711a86db3dd..473746c7b36800f83bbb4f0993587fbbf57f3605 100644 (file)
@@ -8879,7 +8879,7 @@ gen51Code (iCode * lic)
   lineHead = lineCurr = NULL;
 
   /* print the allocation information */
-  if (allocInfo)
+  if (allocInfo && currFunc)
     printAllocInfo (currFunc, codeOutFile);
   /* if debug information required */
   if (options.debug && currFunc)