* src/hc08/ralloc.c (rematStr): fixed bug #879282
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 Jan 2004 07:29:33 +0000 (07:29 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 Jan 2004 07:29:33 +0000 (07:29 +0000)
* src/SDCCast.c (decorateType): fixed bug #880197

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

ChangeLog
src/SDCCast.c
src/hc08/ralloc.c

index ea0272081102dbfb47adb6928bbe2757972154d8..40b839ad4f96e02e61ef0aa1d298dc1925538bd5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-20 Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       * src/hc08/ralloc.c (rematStr): fixed bug #879282
+       * src/SDCCast.c (decorateType): fixed bug #880197
+
 2004-01-20  Michael Hope  <michaelh@juju.net.nz>
 
        * sim/ucsim/gui.src/serio.src/main.cc: Fixed unconditional use of
index 25681f1a62788c0556505a7d1305e7702873a08c..56d377602d3544ac124199651ae5eea03b7aca42 100644 (file)
@@ -3233,6 +3233,23 @@ decorateType (ast * tree)
       /* make sure the type is complete and sane */
       checkTypeSanity(LETYPE(tree), "(cast)");
 
+      /* If code memory is read only, then pointers to code memory */
+      /* implicitly point to constants -- make this explicit       */
+      {
+       sym_link *t = LTYPE(tree);
+       while (t && t->next)
+         {
+           if (IS_CODEPTR(t) && port->mem.code_ro)
+             {
+               if (IS_SPEC(t->next))
+                 SPEC_CONST (t->next) = 1;
+               else
+                 DCL_PTR_CONST (t->next) = 1;
+             }
+           t = t->next;
+          }
+      }
+
 #if 0
       /* if the right is a literal replace the tree */
       if (IS_LITERAL (RETYPE (tree))) {
index f413f7653370a6fb3b5f81689fc4e0d99d1cfa54..be4a1c977ebce08c6d594969155ca09f01e06c4b 100644 (file)
@@ -1596,7 +1596,6 @@ rematStr (symbol * sym)
   
   while (1)
     {
-
       /* if plus or minus print the right hand side */
       if (ic->op == '+' || ic->op == '-')
        {
@@ -1629,7 +1628,7 @@ rematStr (symbol * sym)
       /* we reached the end */
       if (ic->op == ADDRESS_OF)
         sprintf (s, "%s", OP_SYMBOL (IC_LEFT (ic))->rname);
-      else if (ic->op == '=');
+      else if (ic->op == '=')
         sprintf (s, "0x%04x", (int) operandLitValue (IC_RIGHT (ic)) );
       break;
     }