mirror of
https://github.com/cc65/cc65.git
synced 2025-08-13 08:25:28 +00:00
Fixed codegen with addresses as boolean test conditions.
Fixed warning on unreachable code of if body.
This commit is contained in:
@@ -70,7 +70,7 @@ unsigned Test (unsigned Label, int Invert)
|
|||||||
DoDeferred (SQP_KEEP_NONE, &Expr);
|
DoDeferred (SQP_KEEP_NONE, &Expr);
|
||||||
|
|
||||||
/* Result is constant, so we know the outcome */
|
/* Result is constant, so we know the outcome */
|
||||||
Result = (Expr.IVal != 0);
|
Result = (Expr.IVal != 0) ? TESTEXPR_TRUE : TESTEXPR_FALSE;
|
||||||
|
|
||||||
/* Constant rvalue */
|
/* Constant rvalue */
|
||||||
if (!Invert && Expr.IVal == 0) {
|
if (!Invert && Expr.IVal == 0) {
|
||||||
@@ -86,7 +86,12 @@ unsigned Test (unsigned Label, int Invert)
|
|||||||
DoDeferred (SQP_KEEP_NONE, &Expr);
|
DoDeferred (SQP_KEEP_NONE, &Expr);
|
||||||
|
|
||||||
/* Object addresses are non-NULL */
|
/* Object addresses are non-NULL */
|
||||||
Result = 1;
|
Result = TESTEXPR_TRUE;
|
||||||
|
|
||||||
|
/* Condition is always true */
|
||||||
|
if (Invert) {
|
||||||
|
g_jump (Label);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} 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_TRUE 1 /* Expression yields true */
|
||||||
#define TESTEXPR_FALSE 2 /* Expression yields false */
|
#define TESTEXPR_FALSE 0 /* Expression yields false */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user