OSDN Git Service

PR middle-end/51893
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Mar 2012 09:06:03 +0000 (09:06 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Mar 2012 09:06:03 +0000 (09:06 +0000)
* expmed.c (store_bit_field_1): Fix wordnum value for big-endian
targets.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@185909 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expmed.c

index a316450..34e3c9c 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-28  Aurelien Buhrig  <aurelien.buhrig.gcc@gmail.com>
+
+       PR middle-end/51893
+       * expmed.c (store_bit_field_1): Fix wordnum value for big-endian
+       targets.
+
 2012-03-28  Georg-Johann Lay  <avr@gjlay.de>
 
        Backport from 2012-03-28 mainline r185907.
index db6b1b4..bef833f 100644 (file)
@@ -550,7 +550,10 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
        {
          /* 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,