// a function's address will never change
return TRUE;
}
+ if (IS_AST_SYM_VALUE(cexpr) &&
+ IN_CODESPACE(SPEC_OCLS(AST_SYMBOL(cexpr)->etype))) {
+ // a symbol in code space will never change
+ // This is only for the 'char *s="hallo"' case and will have to leave
+ return TRUE;
+ }
return FALSE;
case EX_LINK:
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
return FALSE;
case EX_OP:
if (cexpr->opval.op==ARRAYINIT) {
+ fprintf (stderr, "skipping arrayinit\n");
// this is a list of literals
return TRUE;
}
if (ival) {
// set ival's lineno to where the symbol was defined
setAstLineno (ival, lineno=sym->lineDef);
- // check if this is a constant expression
- if (constExprTree(ival)) {
- allocInfo = 0;
- eBBlockFromiCode (iCodeFromAst (ival));
- allocInfo = 1;
- } else {
+ // check if this is not a constant expression
+ if (!constExprTree(ival)) {
werror (E_CONST_EXPECTED, "found expression");
+ // but try to do it anyway
}
+ allocInfo = 0;
+ eBBlockFromiCode (iCodeFromAst (ival));
+ allocInfo = 1;
}
#endif
}
}
/* if it is fixed, then allocate depending on the */
- /* current memory model,same for automatics */
+ /* current memory model, same for automatics */
if (SPEC_SCLS (sym->etype) == S_FIXED ||
- SPEC_SCLS (sym->etype) == S_AUTO)
- {
+ SPEC_SCLS (sym->etype) == S_AUTO) {
+ if (port->mem.default_globl_map != xdata) {
/* set the output class */
SPEC_OCLS (sym->etype) = port->mem.default_globl_map;
/* generate the symbol */
allocIntoSeg (sym);
return;
+ } else {
+ SPEC_SCLS (sym->etype) = S_XDATA;
}
+ }
/* if code change to constant */
if (SPEC_SCLS (sym->etype) == S_CODE) {