Skip to content

Commit

Permalink
partial fix Issue 5332 - Undefined reference to zero length array
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed May 20, 2012
1 parent cb946cd commit d6ee976
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 46 deletions.
5 changes: 2 additions & 3 deletions src/backend/cod1.c
Expand Up @@ -768,7 +768,7 @@ code *getlvalue(code *pcs,elem *e,regm_t keepmsk)
tym_t e1ty;
symbol *s;

//printf("getlvalue(e = %p)\n",e);
//printf("getlvalue(e = %p, keepmsk = x%x)\n",e,(unsigned)keepmsk);
//elem_print(e);
assert(e);
elem_debug(e);
Expand Down Expand Up @@ -1395,8 +1395,7 @@ code *getlvalue(code *pcs,elem *e,regm_t keepmsk)
else if (e->EV.sp.Voffset)
s->Sflags &= ~GTregcand;
if (!(keepmsk & RMstore)) // if not store only
{ s->Sflags |= SFLread; // assume we are doing a read
}
s->Sflags |= SFLread; // assume we are doing a read
break;
case FLpseudo:
#if MARS
Expand Down
7 changes: 4 additions & 3 deletions src/backend/elfobj.c
Expand Up @@ -450,9 +450,10 @@ static IDXSYM elf_addsym(IDXSTR nam, targ_size_t val, unsigned sz,
/* We want globally defined data symbols to have a size because
* zero sized symbols break copy relocations for shared libraries.
*/
assert(!(sz == 0 && (bind == STB_GLOBAL || bind == STB_WEAK) &&
(typ == STT_OBJECT || typ == STT_TLS) &&
sec != SHT_UNDEF));
if(sz == 0 && (bind == STB_GLOBAL || bind == STB_WEAK) &&
(typ == STT_OBJECT || typ == STT_TLS) &&
sec != SHT_UNDEF)
sz = 1; // so fake it if it doesn't

if (I64)
{
Expand Down

0 comments on commit d6ee976

Please sign in to comment.