This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to fix unaligned access in float->union assignment


On Mon, Nov 18, 2002 at 10:18:03AM +0000, Richard Sandiford wrote:
>        corresponding size.  This can occur on a machine with 64 bit registers
>        that uses SFmode for float.  This can also occur for unaligned float
>        structure fields.  */
> !   if (GET_MODE_CLASS (GET_MODE (value)) == MODE_FLOAT)
> !     {
> !       if (GET_CODE (value) != REG)
> !       value = copy_to_reg (value);
> !       value = gen_rtx_SUBREG (word_mode, value, 0);
> !     }
>   
>     /* Now OFFSET is nonzero only if OP0 is memory
>        and is therefore always measured in bytes.  */
> --- 524,532 ----
>        corresponding size.  This can occur on a machine with 64 bit registers
>        that uses SFmode for float.  This can also occur for unaligned float
>        structure fields.  */
> !   if (GET_MODE_CLASS (GET_MODE (value)) != MODE_INT
> !       && GET_MODE_CLASS (GET_MODE (value)) != MODE_PARTIAL_INT)
> !     value = gen_lowpart (word_mode, value);
>   
>     /* Now OFFSET is nonzero only if OP0 is memory
>        and is therefore always measured in bytes.  */
> 
> which was made to handle CONCATs.

Really?  There's another bug then.  The original code puts the
value at byte offset 0, the modified code puts the value at the
"lowpart".  Which is not the same for bigendian.

Can you detect this mistake e.g. on mips?


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]