This is the mail archive of the gcc@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]

store_bit_field() problem


Hi,

I'm analyzing the failure of gcc.c-torture/compile/20000818-1.c on m68k.
gcc aborts in expmed.c:store_bit_field after calling int_mode_for_mode
(which returns BLKmode). When I change in the previous test the test
'bitpos + bitsize == unit' into 'bitpos + bitsize == GET_MODE_BITSIZE
(fieldmode)' the test succeeds. Since there is already a test 'bitsize ==
GET_MODE_BITSIZE (fieldmode)' it makes the whole construct a bit bogus.

I traced this change back to this patch:
http://gcc.gnu.org/ml/gcc-patches/2000-02/msg00301.html
If I basically revert this part of the patch (see patch below) the test
case works fine. My question is now, was there a specific reason for this
patch, which I'm missing?

BTW I was curious why it worked on other big endian targets, so I checked
ppc-linux. It doesn't abort here because op0 has a DFmode mode and not
XFmode, for which int_mode_for_mode returns DImode and the following code
is produced:

(insn 12 10 13 (set (reg:SI 84)
        (subreg:SI (reg/v:DF 82) 4)) -1 (nil)
    (nil))

(insn 13 12 15 (set (subreg:SI (reg/v:DF 83) 4)
        (reg:SI 84)) -1 (nil)
    (nil))

(insn 15 13 16 (set (reg:SI 85)
        (subreg:SI (reg/v:DF 82) 0)) -1 (nil)
    (nil))

(insn 16 15 17 (set (subreg:SI (reg/v:DF 83) 0)
        (reg:SI 85)) -1 (nil)
    (nil))

bye, Roman

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expmed.c,v
retrieving revision 1.83
diff -u -r1.83 expmed.c
--- expmed.c	2001/08/08 22:06:47	1.83
+++ expmed.c	2001/08/11 23:35:44
@@ -287,14 +287,13 @@
      done with a simple store.  For targets that support fast unaligned
      memory, any naturally sized, unit aligned field can be done directly.  */

-  if (bitsize == GET_MODE_BITSIZE (fieldmode)
+  if (bitpos == 0 && bitsize == GET_MODE_BITSIZE (fieldmode)
       && (GET_CODE (op0) != MEM
 	  ? (GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
 	     || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
 	  : (! SLOW_UNALIGNED_ACCESS (fieldmode, align)
 	     || (offset * BITS_PER_UNIT % bitsize == 0
-		 && align % GET_MODE_BITSIZE (fieldmode) == 0)))
-      && (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0))
+		 && align % GET_MODE_BITSIZE (fieldmode) == 0))))
     {
       if (GET_MODE (op0) != fieldmode)
 	{


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