diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 00fe4990f..18f7fece2 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1247,7 +1247,7 @@ static void StructRef (ExprDesc* Expr) return; } - /* If we have a struct pointer that is an lvalue and not already in the + /* If we have a struct pointer that is an lvalue and not already in the * primary, load it now. */ if (ED_IsLVal (Expr) && IsTypePtr (Expr->Type)) { @@ -1676,10 +1676,14 @@ void hie10 (ExprDesc* Expr) case TOK_STAR: NextToken (); - if (evalexpr (CF_NONE, hie10, Expr) != 0) { - /* Expression is not const, indirect value loaded into primary */ - ED_MakeRValExpr (Expr); - } + ExprWithCheck (hie10, Expr); + if (ED_IsLVal (Expr) || !(ED_IsLocConst (Expr) || ED_IsLocStack (Expr)))) { + /* Not a const, load it into the primary and make it a + * calculated value. + */ + ExprLoad (CF_NONE, Expr); + ED_MakeRValExpr (Expr); + } /* If the expression is already a pointer to function, the * additional dereferencing operator must be ignored. */ @@ -1698,7 +1702,7 @@ void hie10 (ExprDesc* Expr) case TOK_AND: NextToken (); - hie10 (Expr); + ExprWithCheck (hie10, Expr); /* The & operator may be applied to any lvalue, and it may be * applied to functions, even if they're no lvalues. */ diff --git a/src/cc65/exprdesc.c b/src/cc65/exprdesc.c index 14200a9e1..cf0986bf8 100644 --- a/src/cc65/exprdesc.c +++ b/src/cc65/exprdesc.c @@ -197,7 +197,7 @@ int ED_IsConstAbs (const ExprDesc* Expr) * a numeric constant, cast to any type. */ { - return ED_IsConst (Expr) && ED_IsLocAbs (Expr); + return (Expr->Flags & (E_MASK_LOC|E_MASK_RTYPE)) == (E_LOC_ABS|E_RTYPE_RVAL); }