Mercurial > hg > CbC > old > device
changeset 838:c7c19e5aefe7
CAST (left value) and BITFIELD
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 03 Dec 2010 22:06:34 +0900 |
parents | 672209eab3b9 |
children | aed9be3c8b78 |
files | mc-codegen.c mc-parse.c |
diffstat | 2 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-codegen.c Fri Dec 03 21:27:34 2010 +0900 +++ b/mc-codegen.c Fri Dec 03 22:06:34 2010 +0900 @@ -4424,14 +4424,15 @@ return(indirect(RINDIRECT+op,cadr(e),type0)); // cadr(e)? case IVAR: case ARRAY: case PERIOD: case ARROW: return(indirect(RINDIRECT+op,e,type0)); // RIVAR? + case BIT_FIELD: + return list3(RBIT_FIELD,cadr(e),caddr(e)); case CAST: stype = type; type = cadddr(e); op = rvalue(cadr(e)); e = list4(CAST,op,caddr(e),cadddr(e)); // should be RCAST? type = stype; - default:return(e); /* idempotent case? */ - } + default:return(e); /* idempotent case? */ } } /* @@ -4486,6 +4487,8 @@ return(indirect(RINDIRECT+op,cadr(e),type0)); // cadr(e)? case IVAR: case ARRAY: case PERIOD: case ARROW: return(indirect(RINDIRECT+op,e,type0)); // RIVAR? + case BIT_FIELD: + return list3(RBIT_FIELD,cadr(e),caddr(e)); case CAST: op = rvalue_t(cadr(e),cadddr(e)); e = list4(CAST,op,caddr(e),cadddr(e)); // should be RCAST?
--- a/mc-parse.c Fri Dec 03 21:27:34 2010 +0900 +++ b/mc-parse.c Fri Dec 03 22:06:34 2010 +0900 @@ -4275,8 +4275,10 @@ type = t; return e1; } else { - e1 = rvalue(e1); - return correct_type(e1,t); + // e1 = rvalue(e1); this can be left value + e1 = correct_type(e1,t); + type = t; + return e1; } } else if (sym==LC) { // statement in expression (GNU extension)