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]

Re: [PATCH 5/5][testsuite] Use stdint.h when needing int of exact size


On Tue, Jul 24, 2007 at 07:24:53PM +0200, Rask Ingemann Lambertsen wrote:

> pr27743.c relies
> on sign extension of bit 31, so a signed 32-bit integer is required. This
> patch uses types from stdint.h to make sure that these requirements are
> met, also on targets where int gives you only 16 bits.

> Index: gcc.dg/torture/pr27743.c
> ===================================================================
> --- gcc.dg/torture/pr27743.c	(revision 126653)
> +++ gcc.dg/torture/pr27743.c	(working copy)
> @@ -1,10 +1,11 @@
> -/* { dg-do run } */
> +/* { dg-do run { target { stdint_types } } } */
>  
> +#include <stdint.h>
>  extern void abort(void);
>  
> -int bar(int a)
> +int32_t bar (int32_t a)
>  {
> -  return ((unsigned) ((a) >> 2)) >> 15;
> +  return ((uint32_t) ((a) >> 2)) >> 15;
>  }
>  
>  int main()

   Are there any comments on this part? I'll use this ChangeLog entry:

2007-07-26  Rask Ingemann Lambertsen  <rask@sygehus.dk>

	* gcc.dg/torture/pr27743.c (bar): Use an integer of exactly 32 bits
	because the test relies on bit 31 to be the sign bit.

-- 
Rask Ingemann Lambertsen


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