can also be static, fixes bug
1733438
* src/SDCCsymt.c (checkSClass): static local vars in reentrant funcs can
have absolute address too
* support/regression/tests/absolute.c: added test for static absolute var
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4841
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2007-06-09 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * src/SDCCmem.c (allocDefault): removed check sym->level==0 for SPEC_ABSA,
+ can also be static, fixes bug 1733438
+ * src/SDCCsymt.c (checkSClass): static local vars in reentrant funcs can
+ have absolute address too
+ * support/regression/tests/absolute.c: added test for static absolute var
+
2007-06-08 Raphael Neider <rneider AT web.de>
* src/regression/Makefile: suppress parallel builds, allow easy
if (sym->_isparm)
return FALSE;
/* if code change to constant */
- if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype))
+ if (sym->ival && SPEC_ABSA (sym->etype))
{
SPEC_OCLS(sym->etype) = c_abs;
}
break;
case S_XDATA:
/* absolute initialized global */
- if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype))
+ if (sym->ival && SPEC_ABSA (sym->etype))
{
SPEC_OCLS(sym->etype) = x_abs;
}
break;
case S_DATA:
/* absolute initialized global */
- if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype))
+ if (sym->ival && SPEC_ABSA (sym->etype))
{
SPEC_OCLS(sym->etype) = d_abs;
}
break;
case S_IDATA:
/* absolute initialized global */
- if (sym->ival && (sym->level==0) && SPEC_ABSA (sym->etype))
+ if (sym->ival && SPEC_ABSA (sym->etype))
{
SPEC_OCLS(sym->etype) = i_abs;
}
/* automatic symbols cannot be given */
/* an absolute address ignore it */
- if (sym->level &&
+ if (sym->level && !IS_STATIC(sym->etype) &&
SPEC_ABSA (sym->etype) &&
(options.stackAuto || reentrant))
{
return compareType (dest->next, src->next);
}
- if (DCL_TYPE (src) == DCL_TYPE (dest)) {
- if (IS_FUNC(src)) {
- //checkFunction(src,dest);
+ if (DCL_TYPE (src) == DCL_TYPE (dest))
+ {
+ if (IS_FUNC(src))
+ {
+ //checkFunction(src,dest);
+ }
+ return compareType (dest->next, src->next);
+ }
+ if (IS_PTR (dest) && IS_GENPTR (src) && IS_VOID(src->next))
+ {
+ return -1;
}
- return compareType (dest->next, src->next);
- }
- if (IS_PTR (dest) && IS_GENPTR (src) && IS_VOID(src->next)) {
- return -1;
- }
if (IS_PTR (src) &&
(IS_GENPTR (dest) ||
((DCL_TYPE(src) == POINTER) && (DCL_TYPE(dest) == IPOINTER))
))
return -1;
- if (IS_PTR (dest) && IS_ARRAY (src)) {
- value *val=aggregateToPointer (valFromType(src));
- int res=compareType (dest, val->type);
- Safe_free(val->type);
- Safe_free(val);
- return res;
- }
+ if (IS_PTR (dest) && IS_ARRAY (src))
+ {
+ value *val=aggregateToPointer (valFromType(src));
+ int res=compareType (dest, val->type);
+ Safe_free(val->type);
+ Safe_free(val);
+ return res;
+ }
if (IS_PTR (dest) && IS_FUNC (dest->next) && IS_FUNC (src))
return compareType (dest->next, src);
return 0;
testAbsolute(void)
{
#if defined(SDCC_mcs51) || defined(SDCC_ds390) || defined(SDCC_hc08)
+ static {mem} at(0xCAB6) char s = 's';
char {mem} *pC = (char {mem} *)(0xCAB0);
int {mem} *pI = (int {mem} *)(0xCAB0);
ASSERT(u == 'x');
ASSERT(pC[7] == 'x');
ASSERT(pC[9] == 'y');
+ ASSERT(pC[6] == 's');
ASSERT(pI[0] == 0x1234);
#endif
}