This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING]: [RFA] Fix c_readstr for BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN case


Ping^2...

	paul

Begin forwarded message:

> From: Paul Koning <paul_koning@dell.com>
> Date: November 23, 2010 10:12:17 AM EST
> To: gcc-patches <gcc-patches@gcc.gnu.org>
> Subject: [RFA] Fix c_readstr for BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN case
> 
> c_readstr produces the wrong answer if BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN and the size of the constant requested matches the word size.  The attached patch corrects this.
> 
> Checked on pdp11; also a bootstrap and make check on Linux-intel
> 
> Ok to commit?
> 
> 	paul
> 
> ChangeLog:
> 
> 2010-11-23  Paul Koning  <ni1d@arrl.net>
> 
> 	* builtins.c (c_readstr): Fix byte order if BYTES_BIG_ENDIAN !=
> 	WORDS_BIG_ENDIAN. 
> 
> Index: builtins.c
> ===================================================================
> --- builtins.c	(revision 166480)
> +++ builtins.c	(working copy)
> @@ -609,7 +609,7 @@
>      if (WORDS_BIG_ENDIAN)
> 	j = GET_MODE_SIZE (mode) - i - 1;
>      if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN
> -	  && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
> +	  && GET_MODE_SIZE (mode) >= UNITS_PER_WORD)
> 	j = j + UNITS_PER_WORD - 2 * (j % UNITS_PER_WORD) - 1;
>      j *= BITS_PER_UNIT;
>      gcc_assert (j < 2 * HOST_BITS_PER_WIDE_INT);
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]