*/
register struct type *tp = (*expp)->ex_type->tp_up;
register struct field *fd = (*expp)->ex_type->tp_field;
- register struct type *atype = tp->tp_unsigned ? uword_type : word_type;
+ register struct type *atype = (tp->tp_unsigned
+ && fd->fd_width >= 8 * word_size)
+ ? uword_type
+ : word_type;
(*expp)->ex_type = atype;
- if (atype->tp_unsigned) { /* don't worry about the sign bit */
+ if (tp->tp_unsigned) { /* don't worry about the sign bit */
ch3bin(expp, RIGHT, intexpr((arith)fd->fd_shift, INT));
ch3bin(expp, '&', intexpr(fd->fd_mask, INT));
}
);
ch3bin(expp, RIGHT, intexpr(bits_in_type - fd->fd_width, INT));
}
- ch3cast(expp, CAST, tp); /* restore its original type */
}
#endif NOBITFIELD
}
}
else { /* oper == ARROW */
- exp = new_oper(sd->sd_type,
- exp, oper, intexpr(sd->sd_offset, INT));
+ if (is_ld_cst(exp)) {
+ exp->VL_VALUE += sd->sd_offset;
+ exp->ex_type = sd->sd_type;
+ }
+ else {
+ exp = new_oper(sd->sd_type,
+ exp, oper, intexpr(sd->sd_offset, INT));
+ }
exp->ex_lvalue = (sd->sd_type->tp_fund != ARRAY);
exp->ex_flags &= ~EX_ILVALUE;
}
int t = GetToken(&tk);
static char *saved_name = (char *)0;
- SkipToNewLine();
+ if (t != EOI) SkipToNewLine();
LineNumber = l; /* the number of the next input line */
if (t == STRING) { /* is there a filespecifier? */
extern char *source; /* defined in main.c */
switch (expr->ex_class) {
case Value: /* just a simple value */
- if (gencode)
- load_val(expr, val);
+ if (gencode) {
+ if (true_label) {
+ /* can only result from ','-expressions with
+ constant right-hand sides ???
+ */
+ ASSERT(is_cp_cst(expr));
+ C_bra(expr->VL_VALUE == 0 ? false_label : true_label);
+ }
+ else load_val(expr, val);
+ }
break;
case String: /* a string constant */
if (gencode) {
register struct field *fd = leftop->ex_type->tp_field;
struct type *tp = leftop->ex_type->tp_up;
arith tmpvar = 0;
- struct type *atype = tp->tp_unsigned ? uword_type : word_type;
+ struct type *atype = ( tp->tp_unsigned
+ && fd->fd_width >= 8 * word_size)
+ ? uword_type
+ : word_type;
/* First some assertions to be sure that the rest is legal */
ASSERT(atype->tp_size == word_size); /* make sure that C_loc() is legal */