Fix bug where the compiler could crash trying to dereference a decayed accessor expression used as |this|.
This commit is contained in:
parent
d64bcc763a
commit
15b65468ac
@ -733,6 +733,7 @@ void startfunc(char *fname);
|
|||||||
void endfunc(void);
|
void endfunc(void);
|
||||||
void alignframe(int numbytes);
|
void alignframe(int numbytes);
|
||||||
void rvalue(value *lval);
|
void rvalue(value *lval);
|
||||||
|
void rvalue(svalue *sval);
|
||||||
void address(symbol *ptr,regid reg);
|
void address(symbol *ptr,regid reg);
|
||||||
void store(value *lval);
|
void store(value *lval);
|
||||||
void loadreg(cell address,regid reg);
|
void loadreg(cell address,regid reg);
|
||||||
|
@ -2784,7 +2784,8 @@ static int nesting=0;
|
|||||||
// this reduces it to an iEXPRESSION. That's ok. We don't touch it
|
// this reduces it to an iEXPRESSION. That's ok. We don't touch it
|
||||||
// otherwise though, so the type checking logic below basically acts the
|
// otherwise though, so the type checking logic below basically acts the
|
||||||
// same. We are careful to not double-evaluate however.
|
// same. We are careful to not double-evaluate however.
|
||||||
rvalue(&implicit_this.val);
|
if (implicit_this.lvalue)
|
||||||
|
rvalue(&implicit_this);
|
||||||
pushreg(sPRI);
|
pushreg(sPRI);
|
||||||
nest_stkusage++;
|
nest_stkusage++;
|
||||||
}
|
}
|
||||||
|
@ -426,6 +426,16 @@ void rvalue(value *lval)
|
|||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapper that automatically markes lvalues as decayed if they are accessors,
|
||||||
|
// since it is illegal to evaluate them twice.
|
||||||
|
void rvalue(svalue *sval)
|
||||||
|
{
|
||||||
|
int ident = sval->val.ident;
|
||||||
|
rvalue(&sval->val);
|
||||||
|
if (ident == iACCESSOR)
|
||||||
|
sval->lvalue = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the address of a symbol into the primary or alternate register (used
|
/* Get the address of a symbol into the primary or alternate register (used
|
||||||
* for arrays, and for passing arguments by reference).
|
* for arrays, and for passing arguments by reference).
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user