diff mbox

Bug fix in store_bit_field_1 for big endian targets (issue 51893)

Message ID 4F7049C5.7040703@gmail.com
State New
Headers show

Commit Message

Aurelien Buhrig March 26, 2012, 10:49 a.m. UTC
>> Passes bootstrap and regression test powerpc64-linux.
> 
> Thanks a lot, Alan!
> 
> So, Aurelien, you only need to adjust the formatting of the patch and post a 
> ChangeLog entry along with it.  TIA.
> 

Thanks Alan!
Bootstrap and regression test for m68k-elf ok, but I have trouble cross
compiling trunk for powerpc64-linux target...

Changelog:
* expmed.c (store_bit_field_1): Fix wordnum value for big endian targets

Will this fix be backported to 4.6 branch for next release?

Aurélien

Comments

Eric Botcazou March 27, 2012, 8:57 p.m. UTC | #1
> Changelog:
> * expmed.c (store_bit_field_1): Fix wordnum value for big endian targets

The author line was missing so I put:

2012-03-27  Aurelien Buhrig  <aurelien.buhrig.gcc@gmail.com>

	PR middle-end/51893
	* expmed.c (store_bit_field_1): Fix wordnum value for big-endian
	targets.

> Will this fix be backported to 4.6 branch for next release?

The policy is to put only fixes for regressions on release branches, and this 
is obviously not a regression.  I think we might want to put it on the 4.7 
branch though, because it's early in the release cycle and we fixed a twin bug 
on that branch (PR middle-end/50325).  But it's up to the RMs, now CCed.
Richard Biener March 28, 2012, 8:02 a.m. UTC | #2
On Tue, 27 Mar 2012, Eric Botcazou wrote:

> > Changelog:
> > * expmed.c (store_bit_field_1): Fix wordnum value for big endian targets
> 
> The author line was missing so I put:
> 
> 2012-03-27  Aurelien Buhrig  <aurelien.buhrig.gcc@gmail.com>
> 
> 	PR middle-end/51893
> 	* expmed.c (store_bit_field_1): Fix wordnum value for big-endian
> 	targets.
> 
> > Will this fix be backported to 4.6 branch for next release?
> 
> The policy is to put only fixes for regressions on release branches, and this 
> is obviously not a regression.  I think we might want to put it on the 4.7 
> branch though, because it's early in the release cycle and we fixed a twin bug 
> on that branch (PR middle-end/50325).  But it's up to the RMs, now CCed.

Yes, it's ok for the 4.7 branch.

Richard.
diff mbox

Patch

Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c	(revision 185732)
+++ gcc/expmed.c	(working copy)
@@ -550,7 +550,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,