scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 81da8e31a5ccc1c0a12f4a3a3fd167a832e55b8b
parent 409eba3f49437859eaa24909067891f775c7ec01
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 22 Apr 2014 08:45:30 +0200

Evaluate expressions in compare()

compare() can not deal with comparsions, so the parameter expressions must
be evaluated before of doing anything else.

Diffstat:
expr.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/expr.c b/expr.c @@ -230,6 +230,8 @@ pcompare(char op, Node *np1, Node *np2) static Node * compare(char op, Node *np1, Node *np2) { + np1 = eval(np1); + np2 = eval(np2); switch (np1->typeop) { case INT: case FLOAT: switch (np1->typeop) {