1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 02:29:32 +00:00

Fixed AND/OR in certain cases where the 'E_NEED_TEST' flag set for usage only in subexpressions should be cleared.

This commit is contained in:
acqn 2020-08-31 20:31:54 +08:00 committed by Oliver Schmidt
parent 28de3423eb
commit 2379504449
2 changed files with 16 additions and 0 deletions

View File

@ -3223,6 +3223,9 @@ static int hieAnd (ExprDesc* Expr, unsigned* TrueLab, int* TrueLabAllocated)
/* Load the value */
LoadExpr (CF_FORCECHAR, Expr);
/* Clear the test flag */
ED_RequireNoTest (Expr);
/* Remember that the jump is used */
HasFalseJump = 1;
@ -3356,6 +3359,9 @@ static void hieOr (ExprDesc *Expr)
/* Get first expr */
LoadExpr (CF_FORCECHAR, Expr);
/* Clear the test flag */
ED_RequireNoTest (Expr);
if (HasTrueJump == 0) {
/* Get a label that we will use for true expressions */
TrueLab = GetLocalLabel();

View File

@ -364,6 +364,16 @@ INLINE void ED_RequireTest (ExprDesc* Expr)
# define ED_RequireTest(Expr) do { (Expr)->Flags |= E_NEED_TEST; } while (0)
#endif
#if defined(HAVE_INLINE)
INLINE void ED_RequireNoTest (ExprDesc* Expr)
/* Mark the expression not for a test. */
{
Expr->Flags &= ~E_NEED_TEST;
}
#else
# define ED_RequireNoTest(Expr) do { (Expr)->Flags &= ~E_NEED_TEST; } while (0)
#endif
#if defined(HAVE_INLINE)
INLINE int ED_GetNeeds (const ExprDesc* Expr)
/* Get flags about what the expression needs. */