scc

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

commit fca65d578482bb75a341943d97153e8b5f87a457
parent c61a84d918f0978ebb8e1abdba5e24aa1a97f916
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Apr 2014 06:35:03 +0200

Update lvalue flag in cast()

An expression after a cast is an lvalue only if the expression
before of the cast was a lvalue.

Diffstat:
Mexpr.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/expr.c b/expr.c @@ -225,6 +225,7 @@ static struct node * cast(void) { Type *tp; + Node *np1, *np2; extern Type *typename(void); if (yytoken == '(') { @@ -233,7 +234,10 @@ cast(void) next(); tp = typename(); expect(')'); - return castcode(cast(), tp); + np1 = cast(); + np2 = castcode(np1, tp); + np2->b.lvalue = np1->b.lvalue; + return np1; default: break; }