Hi,

This patch (for 4.6) fixes a wrong subword index computation in
store_bit_field_1 for big endian targets when value is at least 4 times
bigger than a word (DI REG value with HI words).

It fixes a regression on gcc.c-torture/execute/bitfld-3.c for my current
backend port.

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

OK to commit?

Aurélien
--- gcc-4.6.1.orig/gcc/expmed.c 2011-05-22 21:02:59.000000000 +0200
+++ src/gcc/expmed.c    2012-01-19 09:32:04.000000000 +0100
@@ -589,7 +589,10 @@
        {
          /* If I is 0, use the low-order word in both field and target;
             if I is 1, use the next to lowest word; and so on.  */
-         unsigned int wordnum = (backwards ? nwords - i - 1 : i);
+         unsigned int wordnum = (backwards
+                                  ? GET_MODE_SIZE(fieldmode)/UNITS_PER_WORD
+                                        - i - 1 
+                                  : i);
          unsigned int bit_offset = (backwards
                                     ? MAX ((int) bitsize - ((int) i + 1)
                                            * BITS_PER_WORD,

Reply via email to