This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Fix gcc.c-torture/compile/20000818-1.c on m68k.c
- To: Kazu Hirata <kazu at hxi dot com>
- Subject: Re: Patch: Fix gcc.c-torture/compile/20000818-1.c on m68k.c
- From: Roman Zippel <zippel at linux-m68k dot org>
- Date: Wed, 29 Aug 2001 15:47:36 +0200 (CEST)
- cc: <gcc-patches at gcc dot gnu dot org>, <rth at redhat dot com>
Hi,
On Wed, 29 Aug 2001, Kazu Hirata wrote:
> With the above patch, gcc miscompiles 20000412-5.c. Cutting down to
> the bare minimum, the following is miscompiled on h8300 port.
Sorry, that's my fault.
The patch below fixes this problem.
I'll test it on my machine and submit it.
bye, Roman
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expmed.c,v
retrieving revision 1.89
diff -u -r1.89 expmed.c
--- expmed.c 2001/08/27 22:43:37 1.89
+++ expmed.c 2001/08/29 13:41:07
@@ -330,14 +330,6 @@
op0 = SUBREG_REG (op0);
}
- /* If OP0 is a register, BITPOS must count within a word.
- But as we have it, it counts within whatever size OP0 now has.
- On a bigendian machine, these are not the same, so convert. */
- if (BYTES_BIG_ENDIAN
- && GET_CODE (op0) != MEM
- && unit > GET_MODE_BITSIZE (GET_MODE (op0)))
- bitpos += unit - GET_MODE_BITSIZE (GET_MODE (op0));
-
value = protect_from_queue (value, 0);
if (flag_force_mem)
@@ -350,7 +342,7 @@
done with a simple store. For targets that support fast unaligned
memory, any naturally sized, unit aligned field can be done directly. */
- if (bitnum == 0
+ if (bitpos == 0
&& bitsize == GET_MODE_BITSIZE (fieldmode)
&& (GET_CODE (op0) != MEM
? (GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
@@ -400,6 +392,14 @@
abort ();
}
}
+
+ /* If OP0 is a register, BITPOS must count within a word.
+ But as we have it, it counts within whatever size OP0 now has.
+ On a bigendian machine, these are not the same, so convert. */
+ if (BYTES_BIG_ENDIAN
+ && GET_CODE (op0) != MEM
+ && unit > GET_MODE_BITSIZE (GET_MODE (op0)))
+ bitpos += unit - GET_MODE_BITSIZE (GET_MODE (op0));
/* Storing an lsb-aligned field in a register
can be done with a movestrict instruction. */