scc

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

commit 8c20c2d40ef87863abdc2e65985dae9088b3a3dd
parent 327b03d58b8ba6d5d928c338ea8c32e27a2f9c94
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 22 Apr 2014 08:39:18 +0200

Evaluate expressions in integerop

integerop can not handle with comparisions, so 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 @@ -69,6 +69,8 @@ eval(Node *np) static Node * integerop(char op, Node *np1, Node *np2) { + np1 = eval(np1); + np2 = eval(np2); if (np1->typeop != INT || np2->typeop != INT) error("operator requires integer operands"); typeconv(&np1, &np2);