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]

Re: bf-sign-2


	This fails on 64-bit targets where such a structure is (or may be)
	padded out to 8 bytes.

	Is there any advantage to testing the size of such a struct as
	opposed to `sizeof(int) < 4' or `sizeof(int) * CHAR_BIT < 32' ?

I was just merging in someone else's patch.  I don't know why the sizeof
struct test is there, but didn't see any need to change it until now.

I'll check in this patch.  I tested it on the original 16-bit int target,
and on an alpha.

Mon Mar 22 14:55:58 1999  Jim Wilson  <wilson@cygnus.com>

	* bf-sign-2.c (main): Replace struct sizeof test with 4.

Index: bf-sign-2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/gcc.c-torture/execute/bf-sign-2.c,v
retrieving revision 1.3
diff -p -r1.3 bf-sign-2.c
*** bf-sign-2.c	1999/03/12 16:19:54	1.3
--- bf-sign-2.c	1999/03/22 22:58:13
*************** main ()
*** 40,46 ****
    if ((x.u15 - 2) >= 0)		/* promoted value should be signed */
      abort ();
  
!   if (sizeof (struct { unsigned long u32:32;}) <= sizeof (int))
      {
        if ((x.u31 - 2) >= 0)	/* promoted value should be signed */
  	abort ();
--- 40,48 ----
    if ((x.u15 - 2) >= 0)		/* promoted value should be signed */
      abort ();
  
!   /* Conditionalize check on whether integers are 4 bytes or larger, i.e.
!      larger than a 31 bit bitfield.  */
!   if (sizeof (int) >= 4)
      {
        if ((x.u31 - 2) >= 0)	/* promoted value should be signed */
  	abort ();




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