Fix bitfield loads into char/short.
Removes a premature optimization of char/short loads rewriting the source type. It did so also for bitfield loads, thereby removing all the shifts/maskings.
This commit is contained in:
5
tccgen.c
5
tccgen.c
@ -2320,8 +2320,9 @@ ST_FUNC void vstore(void)
|
||||
ft = vtop[-1].type.t;
|
||||
sbt = vtop->type.t & VT_BTYPE;
|
||||
dbt = ft & VT_BTYPE;
|
||||
if (((sbt == VT_INT || sbt == VT_SHORT) && dbt == VT_BYTE) ||
|
||||
(sbt == VT_INT && dbt == VT_SHORT)) {
|
||||
if ((((sbt == VT_INT || sbt == VT_SHORT) && dbt == VT_BYTE) ||
|
||||
(sbt == VT_INT && dbt == VT_SHORT))
|
||||
&& !(vtop->type.t & VT_BITFIELD)) {
|
||||
/* optimize char/short casts */
|
||||
delayed_cast = VT_MUSTCAST;
|
||||
vtop->type.t = ft & (VT_TYPE & ~(VT_BITFIELD | (-1 << VT_STRUCT_SHIFT)));
|
||||
|
||||
Reference in New Issue
Block a user