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: [testsuite,committed] Fix 16-bit int test (PR52641)


On Mon, Mar 04, 2013 at 12:15:31PM +0100, Georg-Johann Lay wrote:
> http://gcc.gnu.org/r196428
> 
> Fixed this test case that assumed int is always 32 bits at least.
> 
>        PR testsuite/52641
>        PR tree-optimization/52631
>        * gcc.dg/tree-ssa/pr52631.c: Fix 16-bit int.
> 
> --- gcc.dg/tree-ssa/pr52631.c   (revision 196329)
> +++ gcc.dg/tree-ssa/pr52631.c   (working copy)
> @@ -3,7 +3,11 @@
> 
>  unsigned f(unsigned a)
>  {
> +#if __SIZEOF_INT__ == 2
> +  unsigned b = a >> 15;
> +#else
>    unsigned b = a >> 31;
> +#endif

So perhaps better
  unsigned b = a >> (__SIZEOF_INT__ * __CHAR_BIT__ - 1);
?

	Jakub


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