Compiler: Fix improper handling of constant chained relational operators.

Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=3838.
This commit is contained in:
Arkshine 2014-08-13 17:25:09 +02:00
parent 4f525b9150
commit 3b2618f63b

View File

@ -488,6 +488,7 @@ static int plnge_rel(int *opstr,int opoff,int (*hier)(value *lval),value *lval)
int lvalue,opidx;
value lval2 = {0}; /* intialize, to avoid a compiler warning */
int count;
char boolresult;
/* this function should only be called for relational operators */
assert(op1[opoff]==os_le);
@ -504,7 +505,9 @@ static int plnge_rel(int *opstr,int opoff,int (*hier)(value *lval),value *lval)
error(212);
if (count>0) {
relop_prefix();
boolresult = lval->boolresult;
*lval=lval2; /* copy right hand expression of the previous iteration */
lval->boolresult = boolresult;
} /* if */
opidx+=opoff;
plnge2(op1[opidx],hier,lval,&lval2);