From: uz Date: Tue, 20 Oct 2009 08:21:12 +0000 (+0000) Subject: Fixed a problem with bit-fields: Values spanning more than a byte must always X-Git-Tag: V2.13.1~143 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=96b46beee0cecc6ebfaffb6525974919748718bb;p=cc65 Fixed a problem with bit-fields: Values spanning more than a byte must always be loaded as an int. This was not the case if the expression rhs was a char. git-svn-id: svn://svn.cc65.org/cc65/trunk@4382 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/loadexpr.c b/src/cc65/loadexpr.c index fd09a4d7f..4802dbb2b 100644 --- a/src/cc65/loadexpr.c +++ b/src/cc65/loadexpr.c @@ -100,8 +100,9 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) * throw away the high byte anyway and may therefore load just the * low byte. */ - if (ED_IsBitField (Expr) && Expr->BitOffs + Expr->BitWidth <= CHAR_BITS) { - Flags |= CF_CHAR | CF_UNSIGNED; + if (ED_IsBitField (Expr)) { + Flags |= (Expr->BitOffs + Expr->BitWidth <= CHAR_BITS)? CF_CHAR : CF_INT; + Flags |= CF_UNSIGNED; } else { Flags |= TypeOf (Expr->Type); }