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

[Bug target/31309] 6 byte assignment at end of structure reads/writes past end of structure causing SEGV when that memory is not accessable.



------- Comment #9 from matz at gcc dot gnu dot org  2007-07-06 15:42 -------
This helps (the loop already tries to copy the content byte wise, but uses
the wrong modes for that), but someone knowledgeable in that bitfield business
should look at it.  In particular it might happen that extract_bit_field()
doesn't return a value in byte_mode as it's only a suggestion, in which case
we might ICE later.  In that case we probably need to fiddle with explicitely
building subregs.

Index: expr.c
===================================================================
--- expr.c      (revision 126382)
+++ expr.c      (working copy)
@@ -2131,10 +2131,10 @@ copy_blkmode_from_reg (rtx tgtblk, rtx s

       /* Use xbitpos for the source extraction (right justified) and
         xbitpos for the destination store (left justified).  */
-      store_bit_field (dst, bitsize, bitpos % BITS_PER_WORD, word_mode,
+      store_bit_field (dst, bitsize, bitpos % BITS_PER_WORD, byte_mode,
                       extract_bit_field (src, bitsize,
                                          xbitpos % BITS_PER_WORD, 1,
-                                         NULL_RTX, word_mode, word_mode));
+                                         NULL_RTX, word_mode, byte_mode));
     }

   return tgtblk;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31309


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