This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] expr.c: Fix PR middle-end/18008.
>> After the tree optimizers run, I get
>>
>> b->b = (<unnamed type>) (unsigned char) v;
>>
>> where <unnamed type> is a 2-bit integer type. The problem is that we
>> get ANDs from two places. The first one is generated by the cast to
>> (<unnamed type>). The second one is from the assignment, more
>> specifically store_bit_field.
>>
>> The patch fixes the problem by stripping a narrowing conversion.
It seems to me that the right fix is to avoid generating an AND in
store_bit_field if the value assigned is already appropriately narrow.
Jason