/* address of symbol */
if (IS_AST_SYM_VALUE (expr->left)) {
val = copyValue (AST_VALUE (expr->left));
- val->type = newLink ();
+ val->type = newLink (DECLARATOR);
if (SPEC_SCLS (expr->left->etype) == S_CODE) {
DCL_TYPE (val->type) = CPOINTER;
- DCL_PTR_CONST (val->type) = port->mem.code_ro;
+ DCL_TYPE (val->type) = port->mem.code_ro;
}
else if (SPEC_SCLS (expr->left->etype) == S_XDATA)
DCL_TYPE (val->type) = FPOINTER;
IS_ARRAY(expr->right->ftype)) {
val = copyValue (AST_VALUE (expr->right));
- val->type = newLink ();
+ val->type = newLink (DECLARATOR);
if (SPEC_SCLS (expr->right->etype) == S_CODE) {
DCL_TYPE (val->type) = CPOINTER;
DCL_PTR_CONST (val->type) = port->mem.code_ro;
iloop = ilist->init.deep;
lcnt = DCL_ELEM (type);
- for (last_type = type->next; last_type && DCL_ELEM (last_type); last_type = last_type->next)
+ for (last_type = type->next;
+ last_type && IS_DECL(last_type) && DCL_ELEM (last_type);
+ last_type = last_type->next) {
lcnt *= DCL_ELEM (last_type);
+ }
for (;;)
{
resolveIvalSym (sym->ival);
printIval (sym, sym->type, sym->ival, out);
noAlloc--;
- // if sym->ival is a string, WE don't need it anymore
- if (IS_AST_SYM_VALUE(list2expr(sym->ival)) &&
+ /* if sym is a simple string and sym->ival is a string,
+ WE don't need it anymore */
+ if (IS_ARRAY(sym->type) && IS_CHAR(sym->type->next) &&
+ IS_AST_SYM_VALUE(list2expr(sym->ival)) &&
list2val(sym->ival)->sym->isstrlit) {
freeStringSymbol(list2val(sym->ival)->sym);
}