public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
@ 2012-03-21  8:55 Aurelien Buhrig
  2012-03-21 21:53 ` Eric Botcazou
  0 siblings, 1 reply; 7+ messages in thread
From: Aurelien Buhrig @ 2012-03-21  8:55 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

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

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 661 bytes --]

--- 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,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
  2012-03-21  8:55 [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893) Aurelien Buhrig
@ 2012-03-21 21:53 ` Eric Botcazou
  2012-03-23  3:39   ` Alan Modra
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2012-03-21 21:53 UTC (permalink / raw)
  To: Aurelien Buhrig; +Cc: gcc-patches

> 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?

It is OK for mainline on principle but there is no ChangeLog entry and the 
patch doesn't follow the GNU Coding Style: TABs instead of spaces, spaces 
before parentheses, etc.  See the equivalent code in extract_bit_field_1.
Moreover you need to properly test it on a mainstream big-endian platform.

See http://gcc.gnu.org/contribute.html for a more complete reference.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
  2012-03-21 21:53 ` Eric Botcazou
@ 2012-03-23  3:39   ` Alan Modra
  2012-03-24  9:52     ` Eric Botcazou
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Modra @ 2012-03-23  3:39 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Aurelien Buhrig, gcc-patches

On Wed, Mar 21, 2012 at 10:53:07PM +0100, Eric Botcazou wrote:
> > 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?
> 
> It is OK for mainline on principle but there is no ChangeLog entry and the 
> patch doesn't follow the GNU Coding Style: TABs instead of spaces, spaces 
> before parentheses, etc.  See the equivalent code in extract_bit_field_1.
> Moreover you need to properly test it on a mainstream big-endian platform.

Passes bootstrap and regression test powerpc64-linux.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
  2012-03-23  3:39   ` Alan Modra
@ 2012-03-24  9:52     ` Eric Botcazou
  2012-03-26 10:49       ` Aurelien Buhrig
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2012-03-24  9:52 UTC (permalink / raw)
  To: Alan Modra; +Cc: Aurelien Buhrig, gcc-patches

> 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.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
  2012-03-24  9:52     ` Eric Botcazou
@ 2012-03-26 10:49       ` Aurelien Buhrig
  2012-03-27 20:59         ` Eric Botcazou
  0 siblings, 1 reply; 7+ messages in thread
From: Aurelien Buhrig @ 2012-03-26 10:49 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Alan Modra, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]


>> 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



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 603 bytes --]

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,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
  2012-03-26 10:49       ` Aurelien Buhrig
@ 2012-03-27 20:59         ` Eric Botcazou
  2012-03-28  8:02           ` Richard Guenther
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2012-03-27 20:59 UTC (permalink / raw)
  To: Aurelien Buhrig; +Cc: Alan Modra, gcc-patches, Richard Guenther, Jakub Jelinek

> 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.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)
  2012-03-27 20:59         ` Eric Botcazou
@ 2012-03-28  8:02           ` Richard Guenther
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Guenther @ 2012-03-28  8:02 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Aurelien Buhrig, Alan Modra, gcc-patches, Jakub Jelinek

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-28  8:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-21  8:55 [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893) Aurelien Buhrig
2012-03-21 21:53 ` Eric Botcazou
2012-03-23  3:39   ` Alan Modra
2012-03-24  9:52     ` Eric Botcazou
2012-03-26 10:49       ` Aurelien Buhrig
2012-03-27 20:59         ` Eric Botcazou
2012-03-28  8:02           ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).