Mercurial > hg > CbC > old > device
changeset 333:bd3e6eff7d41
before *_value type / rvalue type inconsistency fix
author | kono |
---|---|
date | Thu, 24 Jun 2004 18:14:37 +0900 |
parents | ce85d6106119 |
children | dc81596066df |
files | mc-codegen.c |
diffstat | 1 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-codegen.c Thu Jun 24 15:21:43 2004 +0900 +++ b/mc-codegen.c Thu Jun 24 18:14:37 2004 +0900 @@ -1537,6 +1537,7 @@ static int double_value(int e2,int type) { + if (type>0&&car(type)==BIT_FIELD) e2=rvalue_t(e2,cadr(type)); #if FLOAT_CODE if (car(e2)==CONST) return dlist2(DCONST,(double)cadr(e2)); if (car(e2)==FCONST) return dlist2(DCONST,dcadr(e2)); @@ -1555,6 +1556,7 @@ static int float_value(int e2,int type) { + if (type>0&&car(type)==BIT_FIELD) e2=rvalue_t(e2,cadr(type)); #if FLOAT_CODE #if LONGLONG_CODE if (car(e2)==LCONST) return dlist2(FCONST,(double)lcadr(e2)); @@ -1576,6 +1578,7 @@ static int longlong_value(int e2,int type) { + if (type>0&&car(type)==BIT_FIELD) e2=rvalue_t(e2,cadr(type)); #if LONGLONG_CODE if (car(e2)==CONST) return llist2(LCONST,(long long)cadr(e2)); if (car(e2)==LCONST) return e2; @@ -1598,6 +1601,7 @@ static int ulonglong_value(int e2,int type) { + if (type>0&&car(type)==BIT_FIELD) e2=rvalue_t(e2,cadr(type)); #if LONGLONG_CODE if (car(e2)==CONST) return llist2(LCONST,(unsigned long long)cadr(e2)); if (car(e2)==LCONST) return e2; @@ -1620,6 +1624,7 @@ static int int_value(int e2,int type) { + if (type>0&&car(type)==BIT_FIELD) e2=rvalue_t(e2,cadr(type)); if(scalar(type)) return e2; #if FLOAT_CODE if (car(e2)==DCONST||car(e2)==FCONST) return list2(CONST,(int)dcadr(e2)); @@ -1638,6 +1643,7 @@ static int unsigned_value(int e2,int type) { + if (type>0&&car(type)==BIT_FIELD) e2=rvalue_t(e2,cadr(type)); if(scalar(type)) return e2; #if FLOAT_CODE // if (car(e2)==DCONST||car(e2)==FCONST) return list2(CONST,(unsigned)dcadr(e2)); @@ -2609,16 +2615,16 @@ if (e==0) error(-1); op = 0; switch(type) { - case INT: break; - case UNSIGNED: break; - case VOID: break; - case CHAR: op=COP; type=INT; break; - case UCHAR: op=COP+US; type=UNSIGNED; break; - case SHORT: op=SOP; type=SIGNED; break; + case INT: break; + case UNSIGNED: break; + case VOID: break; + case CHAR: op=COP; type=INT; break; + case UCHAR: op=COP+US; type=UNSIGNED; break; + case SHORT: op=SOP; type=SIGNED; break; case USHORT: op=SOP+US; type=UNSIGNED; break; case LONGLONG: op=LOP; break; case ULONGLONG: op=LOP+US; break; - case FLOAT: op=FOP; break; + case FLOAT: op=FOP; break; case DOUBLE: op=DOP; break; case CODE: return e; case 0: error(-1); return e; @@ -3139,6 +3145,9 @@ { int t1; /* e = rvalue(e); */ +#if BIT_FIELD_CODE + if (type==BIT_FIELD) e = rvalue(e); +#endif if (type==FLOAT && t==DOTS) { t=DOUBLE;} // fall thru if (type==CHAR && t==DOTS) { t=INT;} // fall thru if (t==DOTS) return e; @@ -3154,7 +3163,7 @@ #endif else if ((t1=car(t))==STRUCT||t1==UNION) { if(size(t)!=size(type)) error(TYERR); - } + } /* else error(TYERR); */ type = t; return e; }