http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51893
--- Comment #8 from Aurelien Buhrig <aurelien.buhrig.gcc at gmail dot com> 2012-01-23 08:27:22 UTC --- It seems the problem occurs with big endian targets when value is at least 4 times bigger than a word. Example: bitsize=40, value = reg:DI sub words-->HI. So wordnum = 3. The for loop should start from LSWord to bitsize MSWord (wordnum). So: subword 3 from value, and calls store_bit_fields_1 with bitsize <= BITS_PER_WORD then subword 2, then subword 1 And subword 0 from value should be ignored. Currently, the loop does not begins with subword 3, but with subword "wordnum-1" which is 2. It is not the LSword of value, and the value stored in the bitfield is (value << BITS_PER_WORD).