scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 4245cbfab4b58fc0c0ab667fb2bc66c411963d0c
parent 29ceb0ed7c98fa120b8421aafe1babd0baa95c69
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Apr 2014 08:46:15 +0200

Check types in relational operators in pointers

Before this commit relational() was using bincode(), so
there was no any check of the types of the operands.
With this new change relational() does the same
than eq().

Diffstat:
Mexpr.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/expr.c b/expr.c @@ -95,7 +95,8 @@ int_float: case PTR: case ARY: pointer: switch (op) { - case OEQ: case ONE: + case OLT: case OGT: case OGE: + case OLE: case OEQ: case ONE: if (t1 == ARY) tp1 = mktype(tp1->type, PTR, NULL, 0); else if (t1 != PTR) @@ -339,7 +340,7 @@ relational(void) default: return np; } next(); - np = bincode(op, inttype, np, shift()); + np = arithmetic(op, np, shift()); } }