This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to fix unaligned access in float->union assignment
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Nov 2002 15:07:56 -0800
- Subject: Re: Patch to fix unaligned access in float->union assignment
- References: <wvnk7jbi3l0.fsf@talisman.cambridge.redhat.com>
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~