fixed bug #504479
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 17 Jan 2002 11:38:45 +0000 (11:38 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 17 Jan 2002 11:38:45 +0000 (11:38 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1808 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c
src/SDCCglue.c

index 7092d9ea1e545fbed7f76b1fafdf701b4ef40126..1d3ef845ad0c8cf139a9866855c5131f9fc0360c 100644 (file)
@@ -950,6 +950,13 @@ createIvalCharPtr (ast * sym, sym_link * type, ast * iexpr)
                               newNode ('[', sym,
                                   newAst_VALUE (valueFromLit ((float) i))),
                               newAst_VALUE (valueFromLit (*s))));
+
+      // now we don't need iexpr's symbol anymore
+      {
+       symbol *sym=AST_SYMBOL(iexpr);
+       memmap *segment=SPEC_OCLS(sym->etype);
+       deleteSetItem(&segment->syms, sym);
+      }
       return decorateType (resolveSymbols (rast));
     }
 
index 78ea8bfaa9ed0f9557ca6439d425af685ff5132d..53f2d85ec4f18c3b05c1385941774003a8f873fb 100644 (file)
@@ -154,9 +154,8 @@ aopLiteral (value * val, int offset)
 static void 
 emitRegularMap (memmap * map, bool addPublics, bool arFlag)
 {
-  symbol *sym, *symIval;
+  symbol *sym;
   ast *ival = NULL;
-  memmap *segment;
 
   if (!map)
     return;
@@ -242,10 +241,8 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
          sprintf (newSym->rname,"__xinit_%s", sym->rname);
          SPEC_CONST(newSym->etype)=1;
          SPEC_STAT(newSym->etype)=1;
-         //addSym (SymbolTab, newSym, newSym->name, 0, 0, 1);
-         if (!IS_AGGREGATE(sym->type)) {
-           resolveIvalSym(newSym->ival);
-         }
+         resolveIvalSym(newSym->ival);
+
          // add it to the "XINIT (CODE)" segment
          addSet(&xinit->syms, newSym);
          sym->ival=NULL;
@@ -275,18 +272,6 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
            allocInfo = 1;
          }
        }         
-
-       /* if the ival is a symbol assigned to an aggregate,
-          (bug #458099 -> #462479)
-          we don't need it anymore, so delete it from its segment */
-       if (sym->ival && sym->ival->type == INIT_NODE &&
-           IS_AST_SYM_VALUE(sym->ival->init.node) &&
-           IS_AGGREGATE (sym->type) ) {
-         symIval=AST_SYMBOL(sym->ival->init.node);
-         segment = SPEC_OCLS (symIval->etype);
-         deleteSetItem (&segment->syms, symIval);
-       }
-       
        sym->ival = NULL;
       }