Fixed a character pointer bug
[fw/sdcc] / src / SDCCval.c
index 1da5f3eca83145517f20462138a1926a804405e9..daf3f930f4c6497b6ea7bbbde5a9056370864bc7 100644 (file)
@@ -1201,7 +1201,7 @@ value *valForArray (ast *arrExpr)
     val->type = newLink();    
     if (SPEC_SCLS(arrExpr->left->etype) == S_CODE) {
        DCL_TYPE(val->type) = CPOINTER ;
-       DCL_PTR_CONST(val->type) = 1;
+       DCL_PTR_CONST(val->type) = port->mem.code_ro;
     }
     else
        if (SPEC_SCLS(arrExpr->left->etype) == S_XDATA)
@@ -1213,8 +1213,8 @@ value *valForArray (ast *arrExpr)
                if (SPEC_SCLS(arrExpr->left->etype) == S_IDATA)
                    DCL_TYPE(val->type) = IPOINTER ;
                else
-                   if (SPEC_SCLS(arrExpr->left->etype) == S_FLASH)
-                       DCL_TYPE(val->type) = FLPOINTER ;
+                   if (SPEC_SCLS(arrExpr->left->etype) == S_EEPROM)
+                       DCL_TYPE(val->type) = EEPPOINTER ;
                    else
                        DCL_TYPE(val->type) = POINTER ;
     val->type->next = arrExpr->left->ftype;
@@ -1270,7 +1270,7 @@ value *valForStructElem(ast *structT, ast *elemT)
     val->type = newLink();
     if (SPEC_SCLS(structT->etype) == S_CODE) {
        DCL_TYPE(val->type) = CPOINTER ;
-       DCL_PTR_CONST(val->type) = 1;
+       DCL_PTR_CONST(val->type) = port->mem.code_ro;
     }
     else
        if (SPEC_SCLS(structT->etype) == S_XDATA)
@@ -1282,8 +1282,8 @@ value *valForStructElem(ast *structT, ast *elemT)
                if (SPEC_SCLS(structT->etype) == S_IDATA)
                    DCL_TYPE(val->type) = IPOINTER ;
                else
-                   if (SPEC_SCLS(structT->etype) == S_FLASH)
-                       DCL_TYPE(val->type) = FLPOINTER ;
+                   if (SPEC_SCLS(structT->etype) == S_EEPROM)
+                       DCL_TYPE(val->type) = EEPPOINTER ;
                    else
                        DCL_TYPE(val->type) = POINTER ;
     val->type->next = sym->type;