Fix a preprocessor expression evaluation bug
A subexpression in parentheses lost its string/int type flag and instead used whatever type was left in the stack entry from previous use. In practice we mostly got away with this because most preprocessor expressions are integer, but it could have resulted in a preprocessor expression incorrectly evaluating as zero. If -Wextra was in use you got a warning: Warning 202: Error: 'Can't mix strings and integers in expression' Fixes #1384
This commit is contained in:
parent
471b9f734e
commit
204a5f7bf3
3 changed files with 28 additions and 0 deletions
|
|
@ -406,6 +406,7 @@ int Preprocessor_expr(DOH *s, int *error) {
|
|||
goto extra_rparen;
|
||||
stack[sp - 1].op = EXPR_VALUE;
|
||||
stack[sp - 1].value = stack[sp].value;
|
||||
stack[sp - 1].svalue = stack[sp].svalue;
|
||||
sp--;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue