[PATCH] Fix expansion of TREE_ADDRESSABLE bitwise copies (PR c++/69851)

Bernd Edlinger bernd.edlinger@hotmail.de
Fri Feb 19 20:04:00 GMT 2016


On 19.02.2016 20:04, Jakub Jelinek wrote:
> On Fri, Feb 19, 2016 at 06:42:32PM +0000, Bernd Edlinger wrote:
>> Hi,
>>
>>
>>> --- gcc/expr.c.jj	2016-02-12 00:50:55.000000000 +0100
>>> +++ gcc/expr.c	2016-02-19 10:43:59.639162531 +0100
>>> @@ -6643,14 +6643,24 @@ store_field (rtx target, HOST_WIDE_INT b
>>>   	  /* Except for initialization of full bytes from a CONSTRUCTOR, which
>>>   	     we will handle specially below.  */
>>>   	  && !(TREE_CODE (exp) == CONSTRUCTOR
>>> -	       && bitsize % BITS_PER_UNIT == 0))
>>> +	       && bitsize % BITS_PER_UNIT == 0)
>>> +	  /* And except for bitwise copying of TREE_ADDRESSABLE types,
>>> +	     where the FIELD_DECL has the right bitsize, but TREE_TYPE (exp)
>>> +	     includes some extra padding.  */
>>> +	  && (!TREE_ADDRESSABLE (TREE_TYPE (exp))
>>> +	      || TREE_CODE (exp) != COMPONENT_REF
>>> +	      || TREE_CODE (DECL_SIZE (TREE_OPERAND (exp, 1))) != INTEGER_CST
>>> +	      || (bitsize % BITS_PER_UNIT != 0)
>>> +	      || (bitpos % BITS_PER_UNIT != 0)
>>> +	      || (compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1)), bitsize)
>>> +		  != 0)))
>>>         /* If we are expanding a MEM_REF of a non-BLKmode non-addressable
>>>            decl we must use bitfield operations.  */
>>
>> isn't the indentation of the new block wrong?
>
> No, I think it is correct.
>
> 	Jakub
>


but you are just adding another term to this expression:
  !(TREE_CODE (exp) == CONSTRUCTOR
    && bitsize % BITS_PER_UNIT == 0)

so the result should look like
  !(TREE_CODE (exp) == CONSTRUCTOR
   && bitsize % BITS_PER_UNIT == 0
   && (!TREE_ADDRESSABLE ...
       || TREE_CODE () ...
       ...
       || (compare_tree_int ...
           != 0)))



Bernd.



More information about the Gcc-patches mailing list