mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Fixed codegen with addresses as boolean test conditions.
Fixed warning on unreachable code of if body.
This commit is contained in:
parent
bbfc24770e
commit
f8835d2867
@ -70,7 +70,7 @@ unsigned Test (unsigned Label, int Invert)
|
||||
DoDeferred (SQP_KEEP_NONE, &Expr);
|
||||
|
||||
/* Result is constant, so we know the outcome */
|
||||
Result = (Expr.IVal != 0);
|
||||
Result = (Expr.IVal != 0) ? TESTEXPR_TRUE : TESTEXPR_FALSE;
|
||||
|
||||
/* Constant rvalue */
|
||||
if (!Invert && Expr.IVal == 0) {
|
||||
@ -86,7 +86,12 @@ unsigned Test (unsigned Label, int Invert)
|
||||
DoDeferred (SQP_KEEP_NONE, &Expr);
|
||||
|
||||
/* Object addresses are non-NULL */
|
||||
Result = 1;
|
||||
Result = TESTEXPR_TRUE;
|
||||
|
||||
/* Condition is always true */
|
||||
if (Invert) {
|
||||
g_jump (Label);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -44,9 +44,9 @@
|
||||
|
||||
|
||||
|
||||
#define TESTEXPR_UNKNOWN 0 /* Result of expression unknown */
|
||||
#define TESTEXPR_UNKNOWN -1 /* Result of expression unknown */
|
||||
#define TESTEXPR_TRUE 1 /* Expression yields true */
|
||||
#define TESTEXPR_FALSE 2 /* Expression yields false */
|
||||
#define TESTEXPR_FALSE 0 /* Expression yields false */
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user