[backport from gcc-4.7.1 r185909 ] gcc/ 2012-03-28 Aurelien Buhrig PR middle-end/51893 * expmed.c (store_bit_field_1): Fix wordnum value for big-endian targets. --- gcc-4.6.3/gcc/expmed.c.~1~ 2011-05-22 21:02:59.000000000 +0200 +++ gcc-4.6.3/gcc/expmed.c 2012-06-10 14:44:45.000000000 +0200 @@ -589,7 +589,10 @@ store_bit_field_1 (rtx str_rtx, unsigned { /* 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,