The 'E_NEED_TEST' flag shouldn't be overwritten when loading the expression result.
This commit is contained in:
parent
d87846e1e1
commit
74def4608a
2 changed files with 11 additions and 6 deletions
|
@ -3460,11 +3460,6 @@ static void hieQuest (ExprDesc* Expr)
|
||||||
int Expr3IsNULL; /* Expression 3 is a NULL pointer */
|
int Expr3IsNULL; /* Expression 3 is a NULL pointer */
|
||||||
Type* ResultType; /* Type of result */
|
Type* ResultType; /* Type of result */
|
||||||
|
|
||||||
ED_Init (&Expr2);
|
|
||||||
Expr2.Flags = Expr->Flags & E_MASK_KEEP_RESULT;
|
|
||||||
ED_Init (&Expr3);
|
|
||||||
Expr3.Flags = Expr->Flags & E_MASK_KEEP_RESULT;
|
|
||||||
|
|
||||||
/* Call the lower level eval routine */
|
/* Call the lower level eval routine */
|
||||||
if (Preprocessing) {
|
if (Preprocessing) {
|
||||||
ExprWithCheck (hieOrPP, Expr);
|
ExprWithCheck (hieOrPP, Expr);
|
||||||
|
@ -3476,6 +3471,13 @@ static void hieQuest (ExprDesc* Expr)
|
||||||
if (CurTok.Tok == TOK_QUEST) {
|
if (CurTok.Tok == TOK_QUEST) {
|
||||||
|
|
||||||
int ConstantCond = ED_IsConstAbsInt (Expr);
|
int ConstantCond = ED_IsConstAbsInt (Expr);
|
||||||
|
unsigned Flags = Expr->Flags & E_MASK_KEEP_RESULT;
|
||||||
|
|
||||||
|
ED_Init (&Expr2);
|
||||||
|
Expr2.Flags = Flags;
|
||||||
|
ED_Init (&Expr3);
|
||||||
|
Expr3.Flags = Flags;
|
||||||
|
|
||||||
NextToken ();
|
NextToken ();
|
||||||
|
|
||||||
if (!ConstantCond) {
|
if (!ConstantCond) {
|
||||||
|
@ -3616,7 +3618,10 @@ static void hieQuest (ExprDesc* Expr)
|
||||||
if (!ConstantCond) {
|
if (!ConstantCond) {
|
||||||
/* Define the final label */
|
/* Define the final label */
|
||||||
g_defcodelabel (TrueLab);
|
g_defcodelabel (TrueLab);
|
||||||
|
/* Set up the result expression type */
|
||||||
ED_FinalizeRValLoad (Expr);
|
ED_FinalizeRValLoad (Expr);
|
||||||
|
/* Restore the original evaluation flags */
|
||||||
|
Expr->Flags = (Expr->Flags & ~E_MASK_KEEP_RESULT) | Flags;
|
||||||
} else {
|
} else {
|
||||||
if (Expr->IVal != 0) {
|
if (Expr->IVal != 0) {
|
||||||
*Expr = Expr2;
|
*Expr = Expr2;
|
||||||
|
|
|
@ -266,7 +266,7 @@ ExprDesc* ED_FinalizeRValLoad (ExprDesc* Expr)
|
||||||
{
|
{
|
||||||
Expr->Sym = 0;
|
Expr->Sym = 0;
|
||||||
Expr->Flags &= ~(E_MASK_LOC | E_MASK_RTYPE | E_BITFIELD | E_ADDRESS_OF);
|
Expr->Flags &= ~(E_MASK_LOC | E_MASK_RTYPE | E_BITFIELD | E_ADDRESS_OF);
|
||||||
Expr->Flags &= ~(E_NEED_TEST | E_CC_SET);
|
Expr->Flags &= ~E_CC_SET;
|
||||||
Expr->Flags |= (E_LOC_PRIMARY | E_RTYPE_RVAL);
|
Expr->Flags |= (E_LOC_PRIMARY | E_RTYPE_RVAL);
|
||||||
Expr->Name = 0;
|
Expr->Name = 0;
|
||||||
Expr->IVal = 0; /* No offset */
|
Expr->IVal = 0; /* No offset */
|
||||||
|
|
Loading…
Add table
Reference in a new issue