Fixed problem in SDCCalloc.h & fixed problem allocation
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 5 Nov 2000 19:54:25 +0000 (19:54 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 5 Nov 2000 19:54:25 +0000 (19:54 +0000)
problem of static bit variables

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@487 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCalloc.h
src/SDCCmem.c

index 2ffe5ec246d58e02d8087f4b16611cd7b8bb5b49..c0d71f83b66d11aa57a1a33df987dd9dce9db216 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "SDCCerr.h"
 
-#ifdef OPT_DISABLE_GC
+#if OPT_DISABLE_GC != 0
 
 # include <malloc.h>
 # define GC_malloc(x) calloc((x), 1)
index 9a9cc20922de7d9225f4fb2711e293e2ea69e056..3b47782fff85f20232733bf07ed3f3411ed53138 100644 (file)
@@ -263,8 +263,10 @@ void allocIntoSeg (symbol *sym)
 /*-----------------------------------------------------------------*/
 void allocGlobal ( symbol *sym )
 {
+       
     /* symbol name is internal name  */
-    sprintf (sym->rname,"%s%s", port->fun_prefix, sym->name);
+    if (!sym->level) /* local statics can come here */
+           sprintf (sym->rname,"%s%s", port->fun_prefix, sym->name);
     
     /* add it to the operandKey reset */
     addSet(&operKeyReset,sym);
@@ -535,8 +537,7 @@ void allocLocal ( symbol *sym  )
 
     /* if this is a static variable */
     if ( IS_STATIC (sym->etype)) {
-       SPEC_OCLS(sym->etype) = port->mem.default_local_map;
-       allocIntoSeg (sym);
+       allocGlobal(sym);
         sym->allocreq = 1;
        return   ;
     }