scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit deed2f68c71afdeb172a8362c6c9d3f3b9f60c4b
parent 79ccb978a8d4f8c9c9700bb16d2b97625f3f1dd4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 26 Aug 2015 22:26:42 +0200

Allow conversions between integer and pointers

This kind of constant conversions are very common in array expressions
so this optimization can simplify a lot the IR generated.

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

diff --git a/cc1/expr.c b/cc1/expr.c @@ -430,9 +430,11 @@ constconv(Node *np, Type *newtp) Symbol aux, *sym, *osym = np->sym; switch (newtp->op) { + case PTR: case INT: case ENUM: switch (oldtp->op) { + case PTR: case INT: case ENUM: if (newtp->sign == oldtp->sign)