* src/SDCCglue.c (printChar, printIvalChar, emitStaticSeg),
* src/SDCCast.c (createIvalCharPtr, stringToSymbol): handle strings
with embedded nulls (fixed bug #753752)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3048
4a8a32a2-be11-0410-ad9d-
d568d2c75423
/* to the array element */
char *s = SPEC_CVAL (iexpr->etype).v_char;
int i = 0;
+ int size = getSize (iexpr->ftype);
- while (*s)
+ for (i=0;i<size;i++)
{
rast = newNode (NULLOP,
rast,
newNode ('[', sym,
newAst_VALUE (valueFromLit ((float) i))),
newAst_VALUE (valueFromLit (*s))));
- i++;
s++;
}
- rast = newNode (NULLOP,
- rast,
- newNode ('=',
- newNode ('[', sym,
- newAst_VALUE (valueFromLit ((float) i))),
- newAst_VALUE (valueFromLit (*s))));
// now WE don't need iexpr's symbol anymore
freeStringSymbol(AST_SYMBOL(iexpr));
static int charLbl = 0;
symbol *sym;
set *sp;
+ int size;
// have we heard this before?
for (sp=statsg->syms; sp; sp=sp->next) {
sym=sp->item;
- if (sym->isstrlit &&
- !strcmp(SPEC_CVAL(sym->etype).v_char, SPEC_CVAL(val->etype).v_char)) {
+ size = getSize (sym->type);
+ if (sym->isstrlit && size == getSize (val->type) &&
+ !memcmp(SPEC_CVAL(sym->etype).v_char, SPEC_CVAL(val->etype).v_char, size)) {
// yes, this is old news. Don't publish it again.
sym->isstrlit++; // but raise the usage count
return symbolVal(sym);
while (len && pplen < plen)
{
i = 60;
- while (i && *s && pplen < plen)
+ while (i && pplen < plen)
{
if (*s < ' ' || *s == '\"' || *s=='\\')
{
else
len = 0;
}
- tfprintf (ofile, "\t!db !constbyte\n", 0);
}
/*-----------------------------------------------------------------*/
printIvalChar (sym_link * type, initList * ilist, FILE * oFile, char *s)
{
value *val;
- int remain;
if (!s)
{
printChar (oFile, SPEC_CVAL (val->etype).v_char, DCL_ELEM (type));
- if ((remain = (DCL_ELEM (type) - strlen (SPEC_CVAL (val->etype).v_char) - 1)) > 0)
- while (remain--)
- tfprintf (oFile, "\t!db !constbyte\n", 0);
-
return 1;
}
else
SPEC_CVAL (sym->etype).v_char)
printChar (out,
SPEC_CVAL (sym->etype).v_char,
- strlen (SPEC_CVAL (sym->etype).v_char) + 1);
+ size);
else
tfprintf (out, "\t!ds\n", (unsigned int) size & 0xffff);
}
"DS80C390", /* Target name */
NULL, /* processor */
{
+ glue,
FALSE, /* Emit glue around main */
MODEL_FLAT24,
MODEL_FLAT24