This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc.dg/compat/struct-layout-1.exp does not supported installed-compiler testing
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Ian Lance Taylor <ian at airs dot com>, gcc mailing list <gcc at gcc dot gnu dot org>, Janis Johnson <janis187 at us dot ibm dot com>, DJ Delorie <dj at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 May 2005 04:26:01 -0400
- Subject: Re: gcc.dg/compat/struct-layout-1.exp does not supported installed-compiler testing
- References: <4287E531.8030000@codesourcery.com> <m38y2fg944.fsf@gossamer.airs.com> <42893A3C.4010507@codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, May 16, 2005 at 05:26:36PM -0700, Mark Mitchell wrote:
> 2005-05-16 Mark Mitchell <mark@codesourcery.com>
>
> * gcc.dg/compat/generate-random.c (config.h): Do not include.
> (limits.h): Include unconditionally.
> (stdlib.h): Likewise.
> * gcc.dg/compat/generate-random_r.c (config.h): Do not include.
> (limits.h): Include unconditionally.
> (stdlib.h): Likewise.
> * gcc.dg/compat/struct-layout-1.exp: Do not link with libiberty.
> * gcc.dg/compat/struct-layout-1_generate.c (config.h): Do not include.
> (limits.h): Include unconditionally.
> (stdlib.h): Likewise.
> (hashtab.h): Do not include.
> (getopt.h): Likewise.
> (stddef.h): Include.
> (hashval_t): Define.
> (struct entry): Add "next" field.
> (HASH_SIZE): New macro.
> (hash_table): New variable.
> (switchfiles): Do not use xmalloc.
> (mix): New macro.
> (iterative_hash): New function.
> (hasht): Remove.
> (e_exists): New function.
> (e_insert): Likewise.
> (output): Use, instead of libiberty hashtable functions.
> (main): Do not use getopt. Do not call htab_create.
Thanks.
> + static hashval_t
> + iterative_hash (const void *k_in /* the key */,
> + register size_t length /* the length of the key */,
> + register hashval_t initval /* the previous hash, or
> + an arbitrary value */)
> + {
> + register const unsigned char *k = (const unsigned char *)k_in;
> + register hashval_t a,b,c,len;
> +
> + /* Set up the internal state */
> + len = length;
> + a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
> + c = initval; /* the previous hash value */
> +
> + /*---------------------------------------- handle most of the key */
> + #ifndef WORDS_BIGENDIAN
> + /* On a little-endian machine, if the data is 4-byte aligned we can hash
> + by word for better speed. This gives nondeterministic results on
> + big-endian machines. */
WORDS_BIGENDIAN is not being defined in the headers that are included.
I think best would be just to kill this hunk and unconditionally do it the
slower way.
> + if (sizeof (hashval_t) == 4 && (((size_t)k)&3) == 0)
> + while (len >= 12) /* aligned */
> + {
> + a += *(hashval_t *)(k+0);
> + b += *(hashval_t *)(k+4);
> + c += *(hashval_t *)(k+8);
> + mix(a,b,c);
> + k += 12; len -= 12;
> + }
> + else /* unaligned */
> + #endif
> + while (len >= 12)
> + {
> + a += (k[0] +((hashval_t)k[1]<<8) +((hashval_t)k[2]<<16) +((hashval_t)k[3]<<24));
> + b += (k[4] +((hashval_t)k[5]<<8) +((hashval_t)k[6]<<16) +((hashval_t)k[7]<<24));
> + c += (k[8] +((hashval_t)k[9]<<8) +((hashval_t)k[10]<<16)+((hashval_t)k[11]<<24));
> + mix(a,b,c);
> + k += 12; len -= 12;
> + }
Jakub