From: epetrich Date: Tue, 20 Jan 2004 07:29:33 +0000 (+0000) Subject: * src/hc08/ralloc.c (rematStr): fixed bug #879282 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=c3834a8c7f5146a2d4707e61a89e33557afa2fe1;p=fw%2Fsdcc * src/hc08/ralloc.c (rematStr): fixed bug #879282 * 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 --- diff --git a/ChangeLog b/ChangeLog index ea027208..40b839ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-01-20 Erik Petrich + + * src/hc08/ralloc.c (rematStr): fixed bug #879282 + * src/SDCCast.c (decorateType): fixed bug #880197 + 2004-01-20 Michael Hope * sim/ucsim/gui.src/serio.src/main.cc: Fixed unconditional use of diff --git a/src/SDCCast.c b/src/SDCCast.c index 25681f1a..56d37760 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -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))) { diff --git a/src/hc08/ralloc.c b/src/hc08/ralloc.c index f413f765..be4a1c97 100644 --- a/src/hc08/ralloc.c +++ b/src/hc08/ralloc.c @@ -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; }