* src/SDCCast.c (decorateType): disabled a transformation I added in
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 26 Nov 2003 18:19:53 +0000 (18:19 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 26 Nov 2003 18:19:53 +0000 (18:19 +0000)
revision 1.188 (access to fields of a structure at an absolute address);
it breaks with bitfields, extern declarations, and gcse analysis.
* src/SDCCopt.c (isLocalWithoutDef): if ADDRESS_OF applied to a symbol, it
could be assigned through a pointer, so don't complain.
* src/SDCCast.c (astErrors),
* src/SDCCast.h,
* src/SDCCglue.c (emitRegularMap): fixed bug #847813

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

ChangeLog
src/SDCCast.c
src/SDCCast.h
src/SDCCglue.c
src/SDCCopt.c

index 82c464396a8c8b257faecf813c95ee7572342c24..5fdaf8cc12c9c99da7ae90f2568713cf83c025f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-11-26 Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       * src/SDCCast.c (decorateType): disabled a transformation I added in
+       revision 1.188 (access to fields of a structure at an absolute address);
+       it breaks with bitfields, extern declarations, and gcse analysis.
+       * src/SDCCopt.c (isLocalWithoutDef): if ADDRESS_OF applied to a symbol, it
+       could be assigned through a pointer, so don't complain.
+       * src/SDCCast.c (astErrors),
+       * src/SDCCast.h,
+       * src/SDCCglue.c (emitRegularMap): fixed bug #847813
+
 2003-11-26 Vangelis Rokas <vrokas@otenet.gr>
        
        * src/pic16/main.c (_pic16_genIVT): fixed interrupt vector table
index fcf18e220e2559e82f311c62bf240018ce02f156..a0fe596018246c8bf72eb8ab948ed580d540897f 100644 (file)
@@ -2242,6 +2242,10 @@ decorateType (ast * tree)
        break;
       }
       
+      /* This breaks with extern declarations, bitfields, and perhaps other */
+      /* cases (gcse). Let's leave this optimization disabled for now and   */
+      /* ponder if there's a safe way to do this. -- EEP                    */
+      #if 0
       if (IS_ADDRESS_OF_OP (tree->left) && IS_AST_SYM_VALUE(tree->left->left)
           && SPEC_ABSA (AST_SYMBOL (tree->left->left)->etype))
         {
@@ -2274,7 +2278,8 @@ decorateType (ast * tree)
             tree->left = NULL;
             tree->right = NULL;
         }
-
+      #endif
+      
       return tree;
 
       /*------------------------------------------------------------------*/
@@ -5696,3 +5701,23 @@ void PA(ast *t)
 {
        ast_print(t,stdout,0);
 }
+
+
+
+/*-----------------------------------------------------------------*/
+/* astErrors : returns non-zero if errors present in tree          */
+/*-----------------------------------------------------------------*/
+int astErrors(ast *t)
+{
+  int errors=0;
+  
+  if (t)
+    {
+      if (t->isError)
+        errors++;
+      errors += astErrors(t->left);
+      errors += astErrors(t->right);
+    }
+    
+  return errors;
+}
index 2054e1df6413db89ceda06e36b71bf0a37f30c38..589141f9cb7e26af80b92ee410bc48c92fc65a17 100644 (file)
@@ -211,6 +211,7 @@ bool hasSEFcalls (ast *);
 void addSymToBlock (symbol *, ast *);
 void freeStringSymbol(symbol *);
 DEFSETFUNC(resetParmKey);
+int astErrors(ast *);
 
 // exported variables 
 extern set *operKeyReset;
index 5a12ac3bce2a1c1bd12594a19c7d0157312af297..4b63602144e1d771f7f06f0e5424b52f012408a4 100644 (file)
@@ -321,7 +321,8 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
              // but try to do it anyway
            }
            allocInfo = 0;
-           eBBlockFromiCode (iCodeFromAst (ival));
+            if (!astErrors(ival))
+             eBBlockFromiCode (iCodeFromAst (ival));
            allocInfo = 1;
          }
        }         
index 677f72b916170c8d5019cf5a58bdf0f9794b1420..1861ef2c87f0864b82781fc5a88b1d0926fdfa09 100644 (file)
@@ -572,6 +572,9 @@ isLocalWithoutDef (symbol * sym)
   if (IS_AGGREGATE (sym->type))
     return 0;
   
+  if (sym->addrtaken)
+    return 0;
+  
   return !sym->defs;
 }