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]

[PATCH] Generated structure layout tests for gcc.dg/compat/struct-layout-1 (take 4)


On Thu, Jul 22, 2004 at 06:29:52PM +0200, Michael Matz wrote:
> > The generator uses pseudo-random generator, which I'm afraid will give
> > different results between different hosts.
> 
> We could include a private version of a RNG, and fix the beginning seed.  
> I don't think generating the files would be necessary, but it surely would
> be nice, and satisfy my esthetic sense (of not including megabytes of
> generated files)  ;-)

Assuming the license of glibc random.c/random_r.c is ok,
here is 4th (and hopefully last) attempt for the struct-layout-1 testsuite,
this time occupying less than 100KB in the testsuite.
There is a new gcc.dg/compat/struct-layout-1.exp dejagnu driver
which takes care of compiling/running the generator and running the tests
afterwards.
The splitting of tests into files has been moved into the *generate.c
source from the shell/awk script.
The generator now can be run in 2 different modes:
struct-layout-1_generate -s .../gcc/testsuite/gcc.dg/compat \
			 -d .../obj/gcc/testsuite -n COUNT
will populate .../obj/gcc/testsuite directory with COUNT test structures
(if COUNT is <= 3000, 3000 tests will be generated, if it is less than
approx. 18k, 18k tests will be created, if it is more than that, it will
create that number of tests exactly).  If -n COUNT is not given, it defaults
to 3000.
Another mode is
struct-layout-1_generate -i IDX
which will on stdout print structure/union test IDX, say
struct-layout-1_generate -i 1
will print second test, i.e.:
T(1,unsigned int a;,F(1,a,1189259747U,1422942914U))

Ok to commit?

2004-07-23  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.in (site.exp): Add HOSTCC and HOSTCFLAGS to site.exp.
testsuite/
	* README.compat: Add RUN_ALL_COMPAT_TESTS documentation.
	* lib/compat.exp: Replace ^$tmpdir/? in testcase names with tmpdir-.
	* gcc.dg/compat/struct-layout-1.exp: New testsuite driver.
	* gcc.dg/compat/struct-layout-1_generate.c: New testcase generator.
	* gcc.dg/compat/generate-random.c: New file.
	* gcc.dg/compat/generate-random.h: Likewise.
	* gcc.dg/compat/generate-random_r.c: Likewise.
	* gcc.dg/compat/struct-layout-1.h: Likewise.
	* gcc.dg/compat/struct-layout-1_x1.h: Likewise.
	* gcc.dg/compat/struct-layout-1_x2.h: Likewise.
	* gcc.dg/compat/struct-layout-1_y1.h: Likewise.
	* gcc.dg/compat/struct-layout-1_y2.h: Likewise.
	* gcc.dg/compat/struct-layout-1_main.c: New test.
	* gcc.dg/compat/struct-layout-1_x.c: New file.
	* gcc.dg/compat/struct-layout-1_y.c: New file.
	* gcc.dg/compat/struct-layout-1_test.h: New file.

--- gcc/Makefile.in.jj	2004-07-21 17:04:41.000000000 +0200
+++ gcc/Makefile.in	2004-07-23 13:05:57.438975735 +0200
@@ -3421,6 +3421,8 @@ site.exp: ./config.status Makefile
 # CFLAGS is set even though it's empty to show we reserve the right to set it.
 	@echo "set CFLAGS \"\"" >> ./tmp0
 	@echo "set CXXFLAGS \"\"" >> ./tmp0
+	@echo "set HOSTCC \"$(CC)\"" >> ./tmp0
+	@echo "set HOSTCFLAGS \"$(CFLAGS)\"" >> ./tmp0
 	@echo "set TESTING_IN_BUILD_TREE 1" >> ./tmp0
 	@echo "set HAVE_LIBSTDCXX_V3 1" >> ./tmp0
 # If newlib has been configured, we need to pass -B to gcc so it can find
--- gcc/testsuite/gcc.dg/compat/generate-random.h.jj	2004-07-23 12:51:06.107358044 +0200
+++ gcc/testsuite/gcc.dg/compat/generate-random.h	2004-07-23 10:46:11.000000000 +0200
@@ -0,0 +1,33 @@
+/* Copyright (C) 2004 Free Software Foundation
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+struct generate_random_data
+  {
+    int *fptr, *rptr, *state;
+    int rand_type, rand_deg, rand_sep;
+    int *end_ptr;
+  };
+
+extern void generate_srandom (unsigned int);
+extern char *generate_initstate (unsigned int, char *, size_t);
+extern char *generate_setstate (char *);
+extern long int generate_random (void);
+extern int generate_random_r (struct generate_random_data *, int *);
+extern int generate_srandom_r (unsigned int, struct generate_random_data *);
+extern int generate_initstate_r (unsigned int, char *, size_t,
+				 struct generate_random_data *);
+extern int generate_setstate_r (char *, struct generate_random_data *);
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_test.h.jj	2004-07-23 12:48:25.904660867 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_test.h	2004-07-23 12:48:19.910718872 +0200
@@ -0,0 +1 @@
+T(0,enum E2 a:31;,B(0,a,e2_m1,e2_0))
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c.jj	2004-07-23 12:46:18.614131017 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c	2004-07-23 12:46:12.910138017 +0200
@@ -0,0 +1,15 @@
+#include "struct-layout-1.h"
+
+#define TX(n, type, attrs, fields, ops) extern void test##n (void);
+#include "struct-layout-1_test.h"
+#undef TX
+
+int main (void)
+{
+#define TX(n, type, attrs, fields, ops)   test##n ();
+#include "struct-layout-1_test.h"
+#undef TX
+  if (fails)
+    abort ();
+  exit (0);
+}
--- gcc/testsuite/gcc.dg/compat/struct-layout-1.exp.jj	2004-07-23 12:55:53.859526138 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1.exp	2004-07-23 14:34:11.945912161 +0200
@@ -0,0 +1,139 @@
+# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# This file was written by Jakub Jelinek, <jakub@redhat.com>
+# Based on compat.exp writte by Janis Johnson, <janis187@us.ibm.com>
+
+
+# Test interoperability of two compilers that follow the same ABI.
+#
+# Break simple tests into two pieces and see that they work when linked
+# together.  If an alternate compiler is specified then the two main
+# pieces of each test are compiled with different compilers.  The
+# alternate compiler must be installed, and is specified by defining
+# ALT_CC_UNDER_TEST in the environment.
+#
+# struct-layout-1 are generated structure layout interoperability tests,
+# so a generator first needs to be compiled on host, run there and the
+# generated tests then compiled on build and executed on target.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+global GCC_UNDER_TEST
+
+# Load procedures from common libraries. 
+load_lib standard.exp
+load_lib gcc.exp
+
+#
+# compat-use-alt-compiler -- make the alternate compiler the default
+# 
+proc compat-use-alt-compiler { } {
+    global GCC_UNDER_TEST ALT_CC_UNDER_TEST
+    global same_alt
+
+    # We don't need to do this if the alternate compiler is actually
+    # the same as the compiler under test.
+    if { $same_alt == 0 } then {
+	set GCC_UNDER_TEST $ALT_CC_UNDER_TEST
+    }
+}
+
+#
+# compat-use-tst-compiler -- make compiler under test the default
+#
+proc compat-use-tst-compiler { } {
+    global GCC_UNDER_TEST save_gcc_under_test
+    global same_alt
+
+    # We don't need to do this if the alternate compiler is actually
+    # the same as the compiler under test.
+
+    if { $same_alt == 0 } then {
+	set GCC_UNDER_TEST $save_gcc_under_test
+    }
+}
+
+# Load the language-independent compabibility support procedures.
+# This must be done after the compat-use-*-compiler definitions.
+load_lib compat.exp
+
+gcc_init
+
+# Save variables for the C compiler under test, which each test will
+# change a couple of times.  This must be done after calling gcc-init.
+set save_gcc_under_test $GCC_UNDER_TEST
+
+# Define an identifier for use with this suite to avoid name conflicts
+# with other compat tests running at the same time.
+set sid "c_compat"
+
+# Find out whether there is an alternate compiler to test.  If the
+# variable is defined but is set to "same", that means we use the same
+# compiler twice, which is meaningful if the two parts of COMPAT_OPTIONS
+# are different.
+set use_alt 0
+set same_alt 0
+if [info exists ALT_CC_UNDER_TEST] then {
+    set use_alt 1
+    if [string match "same" $ALT_CC_UNDER_TEST] then {
+	set same_alt 1
+    }
+}
+
+set tstobjdir "$tmpdir/gcc.dg-struct-layout-1"
+set generator "$tmpdir/gcc.dg-struct-layout-1_generate"
+
+set generator_src "$srcdir/$subdir/struct-layout-1_generate.c"
+set generator_src "$generator_src $srcdir/$subdir/generate-random.c"
+set generator_src "$generator_src $srcdir/$subdir/generate-random_r.c"
+set generator_inc "-I$srcdir/$subdir -I$srcdir/../../include"
+set generator_inc "$generator_inc -I$rootme/../libiberty"
+set generator_lib "-L$rootme/../libiberty -liberty"
+set generator_cmd "-o $generator $generator_src $generator_inc $generator_lib"
+
+set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"]
+set status [lindex $status 0]
+if { $status == 0 } then {
+    file delete -force $tstobjdir
+    file mkdir $tstobjdir
+    set generator_args "-s $srcdir/$subdir -d $tstobjdir"
+    if [info exists env(RUN_ALL_COMPAT_TESTS) ] then {
+	set generator_args "$generator_args -n 15000"
+    }
+    set status [remote_exec host "$generator $generator_args"]
+    set status [lindex $status 0]
+    if { $status == 0 } then {
+	foreach src [lsort [find $tstobjdir *_main.c]] {
+	    # If we're only testing specific files and this isn't one
+	    # of them, skip it.
+	    if ![runtest_file_p $runtests $src] then {
+		continue
+	    }
+
+	    compat-execute $src $sid $use_alt
+	}
+    } else {
+	warning "Could not execute gcc.dg/compat/struct-layout-1 generator"
+    }
+} else {
+    warning "Could not compiler gcc.dg/compat/struct-layout-1 generator"
+}
+
+# Restore the original compiler under test.
+compat-use-tst-compiler
--- gcc/testsuite/gcc.dg/compat/struct-layout-1.h.jj	2004-07-22 14:58:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1.h	2004-07-23 14:35:43.641776055 +0200
@@ -0,0 +1,501 @@
+#include <complex.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include "compat-common.h"
+
+#ifndef SKIP_ATTRIBUTE
+# include "vector-defs.h"
+#else
+typedef int qi;
+typedef int hi;
+typedef int si;
+typedef int di;
+typedef float sf;
+typedef float df;
+typedef int v8qi;
+typedef int v16qi;
+typedef int v2hi;
+typedef int v4hi;
+typedef int v8hi;
+typedef int v2si;
+typedef int v4si;
+typedef int v1di;
+typedef int v2di;
+typedef int v2sf;
+typedef int v4sf;
+typedef int v16sf;
+typedef int v2df;
+typedef int u8qi;
+typedef int u16qi;
+typedef int u2hi;
+typedef int u4hi;
+typedef int u8hi;
+typedef int u2si;
+typedef int u4si;
+typedef int u1di;
+typedef int u2di;
+typedef int u2sf;
+typedef int u4sf;
+typedef int u16sf;
+typedef int u2df;
+#endif
+#if (defined __i386__ || defined __x86_64__) && !defined SKIP_ATTRIBUTE
+# ifdef __MMX__
+#  include <mmintrin.h>
+# else
+typedef int __m64;
+# endif
+# ifdef __SSE__
+#  include <xmmintrin.h>
+# else
+typedef int __m128;
+# endif
+#else
+typedef int __m64;
+typedef int __m128;
+#endif
+
+#define FLDS_MAX	32
+extern struct Info
+{
+  int nfields, nbitfields;
+  void *sp, *a0p, *a3p;
+  void *flds[FLDS_MAX];
+  size_t sz, sizes[FLDS_MAX];
+  size_t als, ala0, ala3, aligns[FLDS_MAX];
+} info;
+
+extern int intarray[256];
+extern int fn0 (void), fn1 (void), fn2 (void), fn3 (void), fn4 (void);
+extern int fn5 (void), fn6 (void), fn7 (void), fn8 (void), fn9 (void);
+
+#ifdef DBG
+#define FAIL(n, m) printf ("fail %d.%d\n", n, m), ++fails
+#else
+#define FAIL(n, m) ++fails
+#endif
+
+#ifdef SKIP_ATTRIBUTE
+# define __attribute__(x)
+#endif
+#define atal		__attribute__((aligned))
+#define atpa		__attribute__((packed))
+#define atalpa		__attribute__((aligned, packed))
+#define atpaal		__attribute__((packed, aligned))
+#define atal1		__attribute__((aligned (1)))
+#define atal2		__attribute__((aligned (2)))
+#define atal4		__attribute__((aligned (4)))
+#define atal8		__attribute__((aligned (8)))
+#define atal16		__attribute__((aligned (16)))
+#define atal1pa		__attribute__((aligned (1), packed))
+#define atal2pa		__attribute__((aligned (2), packed))
+#define atal4pa		__attribute__((aligned (4), packed))
+#define atal8pa		__attribute__((aligned (8), packed))
+#define atal16pa	__attribute__((aligned (16), packed))
+#define atpaal1		__attribute__((packed, aligned (1)))
+#define atpaal2		__attribute__((packed, aligned (2)))
+#define atpaal4		__attribute__((packed, aligned (4)))
+#define atpaal8		__attribute__((packed, aligned (8)))
+#define atpaal16	__attribute__((packed, aligned (16)))
+
+#define atQI		__attribute__((mode (QI)))
+#define atHI		__attribute__((mode (HI)))
+#define atSI		__attribute__((mode (SI)))
+#define atDI		__attribute__((mode (DI)))
+
+enum E0 { e0_0 };
+enum E1 { e1_0, e1_1 };
+enum E2 { e2_m3 = -3, e2_m2, e2_m1, e2_0, e2_1, e2_2, e2_3 };
+enum E3 { e3_m127 = -127, e3_m126, e3_m125, e3_0 = 0, e3_125 = 125, e3_126, e3_127 };
+enum E4 { e4_0, e4_1, e4_2, e4_3, e4_253 = 253, e4_254, e4_255 };
+enum E5 { e5_m32767 = -32767, e5_m32766, e5_m32765, e5_0 = 0, e5_32765 = 32765, e5_32766, e5_32767 };
+enum E6 { e6_0, e6_1, e6_2, e6_3, e6_65533 = 65533, e6_65534, e6_65535 };
+enum E7 { e7_m2147483647 = -2147483647, e7_m2147483646, e7_m2147483645,
+	  e7_0, e7_2147483645 = 2147483645, e7_2147483646, e7_2147483647 };
+enum E8 { e8_0, e8_1, e8_2, e8_3, e8_4294967293 = 4294967293U, e8_4294967294, e8_4294967295 };
+enum E9 { e9_m1099511627775 = -1099511627775LL, e9_m1099511627774, e9_m1099511627773,
+	  e9_0, e9_1099511627773 = 1099511627773LL, e9_1099511627774, e9_1099511627775 };
+
+typedef char Tchar;
+typedef signed char Tschar;
+typedef unsigned char Tuchar;
+typedef short int Tshort;
+typedef unsigned short int Tushort;
+typedef int Tint;
+typedef unsigned int Tuint;
+typedef long int Tlong;
+typedef unsigned long int Tulong;
+typedef long long int Tllong;
+typedef unsigned long long int Tullong;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Tcchar;
+typedef _Complex signed char Tcschar;
+typedef _Complex unsigned char Tcuchar;
+typedef _Complex short int Tcshort;
+typedef _Complex unsigned short int Tcushort;
+typedef _Complex int Tcint;
+typedef _Complex unsigned int Tcuint;
+typedef _Complex long int Tclong;
+typedef _Complex unsigned long int Tculong;
+typedef _Complex long long int Tcllong;
+typedef _Complex unsigned long long int Tcullong;
+#endif
+typedef float Tfloat;
+typedef double Tdouble;
+typedef long double Tldouble;
+typedef _Complex float Tcfloat;
+typedef _Complex double Tcdouble;
+typedef _Complex long double Tcldouble;
+typedef bool Tbool;
+typedef enum E0 TE0;
+typedef enum E1 TE1;
+typedef enum E2 TE2;
+typedef enum E3 TE3;
+typedef enum E4 TE4;
+typedef enum E5 TE5;
+typedef enum E6 TE6;
+typedef enum E7 TE7;
+typedef enum E8 TE8;
+typedef enum E9 TE9;
+typedef void *Tptr;
+typedef char *Tcptr;
+typedef int *Tiptr;
+typedef char Talchar atal;
+typedef signed char Talschar atal;
+typedef unsigned char Taluchar atal;
+typedef short int Talshort atal;
+typedef unsigned short int Talushort atal;
+typedef int Talint atal;
+typedef unsigned int Taluint atal;
+typedef long int Tallong atal;
+typedef unsigned long int Talulong atal;
+typedef long long int Talllong atal;
+typedef unsigned long long int Talullong atal;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Talcchar atal;
+typedef _Complex signed char Talcschar atal;
+typedef _Complex unsigned char Talcuchar atal;
+typedef _Complex short int Talcshort atal;
+typedef _Complex unsigned short int Talcushort atal;
+typedef _Complex int Talcint atal;
+typedef _Complex unsigned int Talcuint atal;
+typedef _Complex long int Talclong atal;
+typedef _Complex unsigned long int Talculong atal;
+typedef _Complex long long int Talcllong atal;
+typedef _Complex unsigned long long int Talcullong atal;
+#endif
+typedef float Talfloat atal;
+typedef double Taldouble atal;
+typedef long double Talldouble atal;
+typedef _Complex float Talcfloat atal;
+typedef _Complex double Talcdouble atal;
+typedef _Complex long double Talcldouble atal;
+typedef bool Talbool atal;
+typedef enum E0 TalE0 atal;
+typedef enum E1 TalE1 atal;
+typedef enum E2 TalE2 atal;
+typedef enum E3 TalE3 atal;
+typedef enum E4 TalE4 atal;
+typedef enum E5 TalE5 atal;
+typedef enum E6 TalE6 atal;
+typedef enum E7 TalE7 atal;
+typedef enum E8 TalE8 atal;
+typedef enum E9 TalE9 atal;
+typedef void *Talptr atal;
+typedef char *Talcptr atal;
+typedef int *Taliptr atal;
+typedef char Tal1char atal1;
+typedef signed char Tal1schar atal1;
+typedef unsigned char Tal1uchar atal1;
+typedef short int Tal1short atal1;
+typedef unsigned short int Tal1ushort atal1;
+typedef int Tal1int atal1;
+typedef unsigned int Tal1uint atal1;
+typedef long int Tal1long atal1;
+typedef unsigned long int Tal1ulong atal1;
+typedef long long int Tal1llong atal1;
+typedef unsigned long long int Tal1ullong atal1;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Tal1cchar atal1;
+typedef _Complex signed char Tal1cschar atal1;
+typedef _Complex unsigned char Tal1cuchar atal1;
+typedef _Complex short int Tal1cshort atal1;
+typedef _Complex unsigned short int Tal1cushort atal1;
+typedef _Complex int Tal1cint atal1;
+typedef _Complex unsigned int Tal1cuint atal1;
+typedef _Complex long int Tal1clong atal1;
+typedef _Complex unsigned long int Tal1culong atal1;
+typedef _Complex long long int Tal1cllong atal1;
+typedef _Complex unsigned long long int Tal1cullong atal1;
+#endif
+typedef float Tal1float atal1;
+typedef double Tal1double atal1;
+typedef long double Tal1ldouble atal1;
+typedef _Complex float Tal1cfloat atal1;
+typedef _Complex double Tal1cdouble atal1;
+typedef _Complex long double Tal1cldouble atal1;
+typedef bool Tal1bool atal1;
+typedef enum E0 Tal1E0 atal1;
+typedef enum E1 Tal1E1 atal1;
+typedef enum E2 Tal1E2 atal1;
+typedef enum E3 Tal1E3 atal1;
+typedef enum E4 Tal1E4 atal1;
+typedef enum E5 Tal1E5 atal1;
+typedef enum E6 Tal1E6 atal1;
+typedef enum E7 Tal1E7 atal1;
+typedef enum E8 Tal1E8 atal1;
+typedef enum E9 Tal1E9 atal1;
+typedef void *Tal1ptr atal1;
+typedef char *Tal1cptr atal1;
+typedef int *Tal1iptr atal1;
+typedef char Tal2char atal2;
+typedef signed char Tal2schar atal2;
+typedef unsigned char Tal2uchar atal2;
+typedef short int Tal2short atal2;
+typedef unsigned short int Tal2ushort atal2;
+typedef int Tal2int atal2;
+typedef unsigned int Tal2uint atal2;
+typedef long int Tal2long atal2;
+typedef unsigned long int Tal2ulong atal2;
+typedef long long int Tal2llong atal2;
+typedef unsigned long long int Tal2ullong atal2;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Tal2cchar atal2;
+typedef _Complex signed char Tal2cschar atal2;
+typedef _Complex unsigned char Tal2cuchar atal2;
+typedef _Complex short int Tal2cshort atal2;
+typedef _Complex unsigned short int Tal2cushort atal2;
+typedef _Complex int Tal2cint atal2;
+typedef _Complex unsigned int Tal2cuint atal2;
+typedef _Complex long int Tal2clong atal2;
+typedef _Complex unsigned long int Tal2culong atal2;
+typedef _Complex long long int Tal2cllong atal2;
+typedef _Complex unsigned long long int Tal2cullong atal2;
+#endif
+typedef float Tal2float atal2;
+typedef double Tal2double atal2;
+typedef long double Tal2ldouble atal2;
+typedef _Complex float Tal2cfloat atal2;
+typedef _Complex double Tal2cdouble atal2;
+typedef _Complex long double Tal2cldouble atal2;
+typedef bool Tal2bool atal2;
+typedef enum E0 Tal2E0 atal2;
+typedef enum E1 Tal2E1 atal2;
+typedef enum E2 Tal2E2 atal2;
+typedef enum E3 Tal2E3 atal2;
+typedef enum E4 Tal2E4 atal2;
+typedef enum E5 Tal2E5 atal2;
+typedef enum E6 Tal2E6 atal2;
+typedef enum E7 Tal2E7 atal2;
+typedef enum E8 Tal2E8 atal2;
+typedef enum E9 Tal2E9 atal2;
+typedef void *Tal2ptr atal2;
+typedef char *Tal2cptr atal2;
+typedef int *Tal2iptr atal2;
+typedef char Tal4char atal4;
+typedef signed char Tal4schar atal4;
+typedef unsigned char Tal4uchar atal4;
+typedef short int Tal4short atal4;
+typedef unsigned short int Tal4ushort atal4;
+typedef int Tal4int atal4;
+typedef unsigned int Tal4uint atal4;
+typedef long int Tal4long atal4;
+typedef unsigned long int Tal4ulong atal4;
+typedef long long int Tal4llong atal4;
+typedef unsigned long long int Tal4ullong atal4;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Tal4cchar atal4;
+typedef _Complex signed char Tal4cschar atal4;
+typedef _Complex unsigned char Tal4cuchar atal4;
+typedef _Complex short int Tal4cshort atal4;
+typedef _Complex unsigned short int Tal4cushort atal4;
+typedef _Complex int Tal4cint atal4;
+typedef _Complex unsigned int Tal4cuint atal4;
+typedef _Complex long int Tal4clong atal4;
+typedef _Complex unsigned long int Tal4culong atal4;
+typedef _Complex long long int Tal4cllong atal4;
+typedef _Complex unsigned long long int Tal4cullong atal4;
+#endif
+typedef float Tal4float atal4;
+typedef double Tal4double atal4;
+typedef long double Tal4ldouble atal4;
+typedef _Complex float Tal4cfloat atal4;
+typedef _Complex double Tal4cdouble atal4;
+typedef _Complex long double Tal4cldouble atal4;
+typedef bool Tal4bool atal4;
+typedef enum E0 Tal4E0 atal4;
+typedef enum E1 Tal4E1 atal4;
+typedef enum E2 Tal4E2 atal4;
+typedef enum E3 Tal4E3 atal4;
+typedef enum E4 Tal4E4 atal4;
+typedef enum E5 Tal4E5 atal4;
+typedef enum E6 Tal4E6 atal4;
+typedef enum E7 Tal4E7 atal4;
+typedef enum E8 Tal4E8 atal4;
+typedef enum E9 Tal4E9 atal4;
+typedef void *Tal4ptr atal4;
+typedef char *Tal4cptr atal4;
+typedef int *Tal4iptr atal4;
+typedef char Tal8char atal8;
+typedef signed char Tal8schar atal8;
+typedef unsigned char Tal8uchar atal8;
+typedef short int Tal8short atal8;
+typedef unsigned short int Tal8ushort atal8;
+typedef int Tal8int atal8;
+typedef unsigned int Tal8uint atal8;
+typedef long int Tal8long atal8;
+typedef unsigned long int Tal8ulong atal8;
+typedef long long int Tal8llong atal8;
+typedef unsigned long long int Tal8ullong atal8;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Tal8cchar atal8;
+typedef _Complex signed char Tal8cschar atal8;
+typedef _Complex unsigned char Tal8cuchar atal8;
+typedef _Complex short int Tal8cshort atal8;
+typedef _Complex unsigned short int Tal8cushort atal8;
+typedef _Complex int Tal8cint atal8;
+typedef _Complex unsigned int Tal8cuint atal8;
+typedef _Complex long int Tal8clong atal8;
+typedef _Complex unsigned long int Tal8culong atal8;
+typedef _Complex long long int Tal8cllong atal8;
+typedef _Complex unsigned long long int Tal8cullong atal8;
+#endif
+typedef float Tal8float atal8;
+typedef double Tal8double atal8;
+typedef long double Tal8ldouble atal8;
+typedef _Complex float Tal8cfloat atal8;
+typedef _Complex double Tal8cdouble atal8;
+typedef _Complex long double Tal8cldouble atal8;
+typedef bool Tal8bool atal8;
+typedef enum E0 Tal8E0 atal8;
+typedef enum E1 Tal8E1 atal8;
+typedef enum E2 Tal8E2 atal8;
+typedef enum E3 Tal8E3 atal8;
+typedef enum E4 Tal8E4 atal8;
+typedef enum E5 Tal8E5 atal8;
+typedef enum E6 Tal8E6 atal8;
+typedef enum E7 Tal8E7 atal8;
+typedef enum E8 Tal8E8 atal8;
+typedef enum E9 Tal8E9 atal8;
+typedef void *Tal8ptr atal8;
+typedef char *Tal8cptr atal8;
+typedef int *Tal8iptr atal8;
+typedef char Tal16char atal16;
+typedef signed char Tal16schar atal16;
+typedef unsigned char Tal16uchar atal16;
+typedef short int Tal16short atal16;
+typedef unsigned short int Tal16ushort atal16;
+typedef int Tal16int atal16;
+typedef unsigned int Tal16uint atal16;
+typedef long int Tal16long atal16;
+typedef unsigned long int Tal16ulong atal16;
+typedef long long int Tal16llong atal16;
+typedef unsigned long long int Tal16ullong atal16;
+#ifndef SKIP_COMPLEX_INT
+typedef _Complex char Tal16cchar atal16;
+typedef _Complex signed char Tal16cschar atal16;
+typedef _Complex unsigned char Tal16cuchar atal16;
+typedef _Complex short int Tal16cshort atal16;
+typedef _Complex unsigned short int Tal16cushort atal16;
+typedef _Complex int Tal16cint atal16;
+typedef _Complex unsigned int Tal16cuint atal16;
+typedef _Complex long int Tal16clong atal16;
+typedef _Complex unsigned long int Tal16culong atal16;
+typedef _Complex long long int Tal16cllong atal16;
+typedef _Complex unsigned long long int Tal16cullong atal16;
+#endif
+typedef float Tal16float atal16;
+typedef double Tal16double atal16;
+typedef long double Tal16ldouble atal16;
+typedef _Complex float Tal16cfloat atal16;
+typedef _Complex double Tal16cdouble atal16;
+typedef _Complex long double Tal16cldouble atal16;
+typedef bool Tal16bool atal16;
+typedef enum E0 Tal16E0 atal16;
+typedef enum E1 Tal16E1 atal16;
+typedef enum E2 Tal16E2 atal16;
+typedef enum E3 Tal16E3 atal16;
+typedef enum E4 Tal16E4 atal16;
+typedef enum E5 Tal16E5 atal16;
+typedef enum E6 Tal16E6 atal16;
+typedef enum E7 Tal16E7 atal16;
+typedef enum E8 Tal16E8 atal16;
+typedef enum E9 Tal16E9 atal16;
+typedef void *Tal16ptr atal16;
+typedef char *Tal16cptr atal16;
+typedef int *Tal16iptr atal16;
+typedef int (*Tfnptr) (void);
+
+/* Bitfield macros.  In C, it is invalid to use numbers larger
+   than type's bitsize, but we don't know the size when generating
+   the testcases.  */
+#define BN8(n) ((((n) - 1) & 7) + 1)
+#define BN16(n) ((((n) - 1) & 15) + 1)
+#define BN32(n) ((((n) - 1) & 31) + 1)
+#define BN64(n) ((((n) - 1) & 63) + 1)
+#define BCN(n) BN8 (n)
+#if USHRT_MAX == 255
+# define BSN(n) BN8 (n)
+#elif USHRT_MAX == 65535
+# define BSN(n) BN16 (n)
+#elif USHRT_MAX == 4294967295U
+# define BSN(n) BN32 (n)
+#elif USHRT_MAX == 18446744073709551615ULL
+# define BSN(n) BN64 (n)
+#endif
+#if UINT_MAX == 255
+# define BIN(n) BN8 (n)
+#elif UINT_MAX == 65535
+# define BIN(n) BN16 (n)
+#elif UINT_MAX == 4294967295U
+# define BIN(n) BN32 (n)
+#elif UINT_MAX == 18446744073709551615ULL
+# define BIN(n) BN64 (n)
+#endif
+#if ULONG_MAX == 255
+# define BLN(n) BN8 (n)
+#elif ULONG_MAX == 65535
+# define BLN(n) BN16 (n)
+#elif ULONG_MAX == 4294967295U
+# define BLN(n) BN32 (n)
+#elif ULONG_MAX == 18446744073709551615ULL
+# define BLN(n) BN64 (n)
+#endif
+#if ULONG_MAX == 255
+# define BLN(n) BN8 (n)
+#elif ULONG_MAX == 65535
+# define BLN(n) BN16 (n)
+#elif ULONG_MAX == 4294967295U
+# define BLN(n) BN32 (n)
+#elif ULONG_MAX == 18446744073709551615ULL
+# define BLN(n) BN64 (n)
+#endif
+#if !defined ULLONG_MAX && defined __LONG_LONG_MAX__
+# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
+#endif
+#if ULLONG_MAX == 255
+# define BQN(n) BN8 (n)
+#elif ULLONG_MAX == 65535
+# define BQN(n) BN16 (n)
+#elif ULLONG_MAX == 4294967295U
+# define BQN(n) BN32 (n)
+#elif ULLONG_MAX == 18446744073709551615ULL
+# define BQN(n) BN64 (n)
+#endif
+
+#define T(n, fields, ops) TX(n, struct, , fields, ({ ops });)
+#define U(n, fields, ops) TX(n, union, , fields, ({ ops });)
+#ifdef SKIP_COMPLEX_INT
+#define TXCI(n, type, attrs, fields, ops)
+#define TCI(n, fields, ops)
+#define UCI(n, fields, ops)
+#else
+#define TXCI(n, type, attrs, fields, ops) TX(n, type, attrs, fields, ({ ops });)
+#define TCI(n, fields, ops) TX(n, struct, , fields, ({ ops });)
+#define UCI(n, fields, ops) TX(n, union, , fields, ({ ops });)
+#endif
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h.jj	2004-07-22 14:58:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h	2004-07-13 20:35:54.000000000 +0200
@@ -0,0 +1,68 @@
+#include "struct-layout-1.h"
+
+struct Info info;
+int fails;
+int intarray[256];
+int fn0 (void) { return 0; }
+int fn1 (void) { return 1; }
+int fn2 (void) { return 2; }
+int fn3 (void) { return 3; }
+int fn4 (void) { return 4; }
+int fn5 (void) { return 5; }
+int fn6 (void) { return 6; }
+int fn7 (void) { return 7; }
+int fn8 (void) { return 8; }
+int fn9 (void) { return 9; }
+
+/* This macro is intended for fields where their
+   addresses/sizes/alignments and value passing should be checked.  */
+#define F(n, x, v, w) 						\
+  info.flds[i] = &s##n.x;					\
+  info.sizes[i] = sizeof (s##n.x);				\
+  info.aligns[i] = __alignof__ (s##n.x);			\
+  s##n.x = v;							\
+  a##n[2].x = w;						\
+  ++i;
+/* This macro is for fields where just their addresses/sizes/alignments
+   should be checked.  */
+#define N(n, x) 						\
+  info.flds[i] = &s##n.x;					\
+  info.sizes[i] = sizeof (s##n.x);				\
+  info.aligns[i] = __alignof__ (s##n.x);			\
+  ++i;
+/* This macro is for fields where just value passing should be checked.  */
+#define B(n, x, v, w)						\
+  s##n.x = v;							\
+  a##n[2].x = w;						\
+  ++j;
+#define TX(n, type, attrs, fields, ops) 			\
+type S##n { fields } attrs;					\
+type S##n s##n;							\
+extern type S##n a##n[5];					\
+extern type S##n check##n (type S##n, type S##n *,		\
+			     type S##n);			\
+extern void check##n##va (int i, ...);				\
+extern void checkx##n (type S##n);				\
+void test##n (void)						\
+{								\
+  int i, j;							\
+  memset (&s##n, '\0', sizeof (s##n));				\
+  memset (a##n, '\0', sizeof (a##n));				\
+  memset (&info, '\0', sizeof (info));				\
+  info.sp = &s##n;						\
+  info.a0p = &a##n[0];						\
+  info.a3p = &a##n[3];						\
+  info.sz = sizeof (s##n);					\
+  info.als = __alignof__ (s##n);				\
+  info.ala0 = __alignof__ (a##n[0]);				\
+  info.ala3 = __alignof__ (a##n[3]);				\
+  if (((uintptr_t) &a##n[3]) & (info.als - 1))			\
+    FAIL (n, 1);						\
+  i = 0; j = 0;							\
+  ops								\
+  info.nfields = i;						\
+  info.nbitfields = j;						\
+  checkx##n (check##n (s##n, &a##n[1], a##n[2]));		\
+  check##n##va (1, 1.0, s##n, 2LL, a##n[2], a##n[2]);		\
+  check##n##va (2, s##n, s##n, 2.0L, a##n[2], s##n);		\
+}
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c.jj	2004-07-23 12:51:35.488166168 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c	2004-07-23 14:34:46.430843912 +0200
@@ -0,0 +1,1562 @@
+/* Structure layout test generator.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+/* Compile with gcc -I$(srcdir)/../include -{I,L}$(objdir)/../libiberty/ \
+   -o struct-layout-1_generate{,.c} generate_random{,_r}.c -liberty */
+
+#include "config.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include "libiberty.h"
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include "hashtab.h"
+#include "getopt.h"
+/* We use our own pseudo-random number generator, so that it gives the same
+   values on all hosts.  */
+#include "generate-random.h"
+
+#if LLONG_MAX != 9223372036854775807LL && __LONG_LONG_MAX__ != 9223372036854775807LL
+# error Need 64-bit long long
+#endif
+
+enum TYPE
+{
+  TYPE_INT,
+  TYPE_UINT,
+  TYPE_CINT,
+  TYPE_CUINT,
+  TYPE_FLOAT,
+  TYPE_CFLOAT,
+  TYPE_SENUM,
+  TYPE_UENUM,
+  TYPE_PTR,
+  TYPE_FNPTR,
+  TYPE_OTHER
+};
+
+struct types
+{
+  const char *name;
+  enum TYPE type;
+  unsigned long long int maxval;
+  char bitfld;
+};
+
+struct types base_types[] = {
+/* As we don't know whether char will be signed or not, just limit ourselves
+   to unsigned values less than maximum signed char value.  */
+{ "char", TYPE_UINT, 127, 'C' },
+{ "signed char", TYPE_INT, 127, 'C' },
+{ "unsigned char", TYPE_UINT, 255, 'C' },
+{ "short int", TYPE_INT, 32767, 'S' },
+{ "unsigned short int", TYPE_UINT, 65535, 'S' },
+{ "int", TYPE_INT, 2147483647, 'I' },
+{ "unsigned int", TYPE_UINT, 4294967295U, 'I' },
+{ "long int", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "unsigned long int", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "long long int", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "unsigned long long int", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "bool", TYPE_UINT, 1, 'B' },
+{ "void *", TYPE_PTR, 0, 0 },
+{ "char *", TYPE_PTR, 0, 0 },
+{ "int *", TYPE_PTR, 0, 0 },
+{ "float", TYPE_FLOAT, 0, 0 },
+{ "double", TYPE_FLOAT, 0, 0 },
+{ "long double", TYPE_FLOAT, 0, 0 },
+#define NTYPES1 18
+{ "Tchar", TYPE_UINT, 127, 'C' },
+{ "Tschar", TYPE_INT, 127, 'C' },
+{ "Tuchar", TYPE_UINT, 255, 'C' },
+{ "Tshort", TYPE_INT, 32767, 'S' },
+{ "Tushort", TYPE_UINT, 65535, 'S' },
+{ "Tint", TYPE_INT, 2147483647, 'I' },
+{ "Tuint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tlong", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Tulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Tllong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Tullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Tbool", TYPE_UINT, 1, 'B' },
+{ "size_t", TYPE_UINT, 18446744073709551615ULL, 0 },
+{ "Tptr", TYPE_PTR, 0, 0 },
+{ "Tcptr", TYPE_PTR, 0, 0 },
+{ "Tiptr", TYPE_PTR, 0, 0 },
+{ "Tfnptr", TYPE_FNPTR, 0, 0 },
+{ "Tfloat", TYPE_FLOAT, 0, 0 },
+{ "Tdouble", TYPE_FLOAT, 0, 0 },
+{ "Tldouble", TYPE_FLOAT, 0, 0 },
+{ "enum E0", TYPE_UENUM, 0, ' ' },
+{ "enum E1", TYPE_UENUM, 1, ' ' },
+{ "enum E2", TYPE_SENUM, 3, ' ' },
+{ "enum E3", TYPE_SENUM, 127, ' ' },
+{ "enum E4", TYPE_UENUM, 255, ' ' },
+{ "enum E5", TYPE_SENUM, 32767, ' ' },
+{ "enum E6", TYPE_UENUM, 65535, ' ' },
+{ "enum E7", TYPE_SENUM, 2147483647, ' ' },
+{ "enum E8", TYPE_UENUM, 4294967295U, ' ' },
+{ "enum E9", TYPE_SENUM, 1099511627775LL, ' ' },
+{ "TE0", TYPE_UENUM, 0, ' ' },
+{ "TE1", TYPE_UENUM, 1, ' ' },
+{ "TE2", TYPE_SENUM, 3, ' ' },
+{ "TE3", TYPE_SENUM, 127, ' ' },
+{ "TE4", TYPE_UENUM, 255, ' ' },
+{ "TE5", TYPE_SENUM, 32767, ' ' },
+{ "TE6", TYPE_UENUM, 65535, ' ' },
+{ "TE7", TYPE_SENUM, 2147483647, ' ' },
+{ "TE8", TYPE_UENUM, 4294967295U, ' ' },
+{ "TE9", TYPE_SENUM, 1099511627775LL, ' ' },
+/* vector-defs.h typedefs */
+{ "qi", TYPE_INT, 127, 0 },
+{ "hi", TYPE_INT, 32767, 0 },
+{ "si", TYPE_INT, 2147483647, 0 },
+{ "di", TYPE_INT, 9223372036854775807LL, 0 },
+{ "sf", TYPE_FLOAT, 0, 0 },
+{ "df", TYPE_FLOAT, 0, 0 }
+#define NTYPES2 (sizeof (base_types) / sizeof (base_types[0]))
+};
+struct types complex_types[] = {
+{ "_Complex char", TYPE_CUINT, 127, 0 },
+{ "_Complex signed char", TYPE_CINT, 127, 0 },
+{ "_Complex unsigned char", TYPE_CUINT, 255, 0 },
+{ "_Complex short int", TYPE_CINT, 32767, 0 },
+{ "_Complex unsigned short int", TYPE_CUINT, 65535, 0 },
+{ "_Complex int", TYPE_CINT, 2147483647, 0 },
+{ "_Complex unsigned int", TYPE_CUINT, 4294967295U, 0 },
+{ "_Complex long int", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "_Complex unsigned long int", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "_Complex long long int", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "_Complex unsigned long long int", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "_Complex float", TYPE_CFLOAT, 0, 0 },
+{ "_Complex double", TYPE_CFLOAT, 0, 0 },
+{ "_Complex long double", TYPE_CFLOAT, 0, 0 },
+{ "Tcchar", TYPE_CUINT, 127, 0 },
+{ "Tcschar", TYPE_CINT, 127, 0 },
+{ "Tcuchar", TYPE_CUINT, 255, 0 },
+{ "Tcshort", TYPE_CINT, 32767, 0 },
+{ "Tcushort", TYPE_CUINT, 65535, 0 },
+{ "Tcint", TYPE_CINT, 2147483647, 0 },
+{ "Tcuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Tclong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tculong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tcllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tcullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tcfloat", TYPE_CFLOAT, 0, 0 },
+{ "Tcdouble", TYPE_CFLOAT, 0, 0 },
+{ "Tcldouble", TYPE_CFLOAT, 0, 0 }
+#define NCTYPES2 (sizeof (complex_types) / sizeof (complex_types[0]))
+};
+struct types vector_types[] = {
+/* vector-defs.h typedefs */
+{ "v8qi", TYPE_OTHER, 0, 0 },
+{ "v16qi", TYPE_OTHER, 0, 0 },
+{ "v2hi", TYPE_OTHER, 0, 0 },
+{ "v4hi", TYPE_OTHER, 0, 0 },
+{ "v8hi", TYPE_OTHER, 0, 0 },
+{ "v2si", TYPE_OTHER, 0, 0 },
+{ "v4si", TYPE_OTHER, 0, 0 },
+{ "v1di", TYPE_OTHER, 0, 0 },
+{ "v2di", TYPE_OTHER, 0, 0 },
+{ "v2sf", TYPE_OTHER, 0, 0 },
+{ "v4sf", TYPE_OTHER, 0, 0 },
+{ "v16sf", TYPE_OTHER, 0, 0 },
+{ "v2df", TYPE_OTHER, 0, 0 },
+{ "u8qi", TYPE_OTHER, 0, 0 },
+{ "u16qi", TYPE_OTHER, 0, 0 },
+{ "u2hi", TYPE_OTHER, 0, 0 },
+{ "u4hi", TYPE_OTHER, 0, 0 },
+{ "u8hi", TYPE_OTHER, 0, 0 },
+{ "u2si", TYPE_OTHER, 0, 0 },
+{ "u4si", TYPE_OTHER, 0, 0 },
+{ "u1di", TYPE_OTHER, 0, 0 },
+{ "u2di", TYPE_OTHER, 0, 0 },
+{ "u2sf", TYPE_OTHER, 0, 0 },
+{ "u4sf", TYPE_OTHER, 0, 0 },
+{ "u16sf", TYPE_OTHER, 0, 0 },
+{ "u2df", TYPE_OTHER, 0, 0 },
+{ "__m64", TYPE_OTHER, 0, 0 },
+{ "__m128", TYPE_OTHER, 0, 0 }
+#define NVTYPES2 (sizeof (vector_types) / sizeof (vector_types[0]))
+};
+struct types attrib_types[] = {
+{ "Talchar", TYPE_UINT, 127, 'C' },
+{ "Talschar", TYPE_INT, 127, 'C' },
+{ "Taluchar", TYPE_UINT, 255, 'C' },
+{ "Talshort", TYPE_INT, 32767, 'S' },
+{ "Talushort", TYPE_UINT, 65535, 'S' },
+{ "Talint", TYPE_INT, 2147483647, 'I' },
+{ "Taluint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tallong", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Talulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Talllong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Talullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Talbool", TYPE_UINT, 1, 'B' },
+{ "Talptr", TYPE_PTR, 0, 0 },
+{ "Talcptr", TYPE_PTR, 0, 0 },
+{ "Taliptr", TYPE_PTR, 0, 0 },
+{ "Talfloat", TYPE_FLOAT, 0, 0 },
+{ "Taldouble", TYPE_FLOAT, 0, 0 },
+{ "Talldouble", TYPE_FLOAT, 0, 0 },
+{ "TalE0", TYPE_UENUM, 0, ' ' },
+{ "TalE1", TYPE_UENUM, 1, ' ' },
+{ "TalE2", TYPE_SENUM, 3, ' ' },
+{ "TalE3", TYPE_SENUM, 127, ' ' },
+{ "TalE4", TYPE_UENUM, 255, ' ' },
+{ "TalE5", TYPE_SENUM, 32767, ' ' },
+{ "TalE6", TYPE_UENUM, 65535, ' ' },
+{ "TalE7", TYPE_SENUM, 2147483647, ' ' },
+{ "TalE8", TYPE_UENUM, 4294967295U, ' ' },
+{ "TalE9", TYPE_SENUM, 1099511627775LL, ' ' },
+{ "Tal1char", TYPE_UINT, 127, 'C' },
+{ "Tal1schar", TYPE_INT, 127, 'C' },
+{ "Tal1uchar", TYPE_UINT, 255, 'C' },
+{ "Tal1short", TYPE_INT, 32767, 'S' },
+{ "Tal1ushort", TYPE_UINT, 65535, 'S' },
+{ "Tal1int", TYPE_INT, 2147483647, 'I' },
+{ "Tal1uint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tal1long", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Tal1ulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Tal1llong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Tal1ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Tal1bool", TYPE_UINT, 1, 'B' },
+{ "Tal1ptr", TYPE_PTR, 0, 0 },
+{ "Tal1cptr", TYPE_PTR, 0, 0 },
+{ "Tal1iptr", TYPE_PTR, 0, 0 },
+{ "Tal1float", TYPE_FLOAT, 0, 0 },
+{ "Tal1double", TYPE_FLOAT, 0, 0 },
+{ "Tal1ldouble", TYPE_FLOAT, 0, 0 },
+{ "Tal1E0", TYPE_UENUM, 0, ' ' },
+{ "Tal1E1", TYPE_UENUM, 1, ' ' },
+{ "Tal1E2", TYPE_SENUM, 3, ' ' },
+{ "Tal1E3", TYPE_SENUM, 127, ' ' },
+{ "Tal1E4", TYPE_UENUM, 255, ' ' },
+{ "Tal1E5", TYPE_SENUM, 32767, ' ' },
+{ "Tal1E6", TYPE_UENUM, 65535, ' ' },
+{ "Tal1E7", TYPE_SENUM, 2147483647, ' ' },
+{ "Tal1E8", TYPE_UENUM, 4294967295U, ' ' },
+{ "Tal1E9", TYPE_SENUM, 1099511627775LL, ' ' },
+{ "Tal2char", TYPE_UINT, 127, 'C' },
+{ "Tal2schar", TYPE_INT, 127, 'C' },
+{ "Tal2uchar", TYPE_UINT, 255, 'C' },
+{ "Tal2short", TYPE_INT, 32767, 'S' },
+{ "Tal2ushort", TYPE_UINT, 65535, 'S' },
+{ "Tal2int", TYPE_INT, 2147483647, 'I' },
+{ "Tal2uint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tal2long", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Tal2ulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Tal2llong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Tal2ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Tal2bool", TYPE_UINT, 1, 'B' },
+{ "Tal2ptr", TYPE_PTR, 0, 0 },
+{ "Tal2cptr", TYPE_PTR, 0, 0 },
+{ "Tal2iptr", TYPE_PTR, 0, 0 },
+{ "Tal2float", TYPE_FLOAT, 0, 0 },
+{ "Tal2double", TYPE_FLOAT, 0, 0 },
+{ "Tal2ldouble", TYPE_FLOAT, 0, 0 },
+{ "Tal2E0", TYPE_UENUM, 0, ' ' },
+{ "Tal2E1", TYPE_UENUM, 1, ' ' },
+{ "Tal2E2", TYPE_SENUM, 3, ' ' },
+{ "Tal2E3", TYPE_SENUM, 127, ' ' },
+{ "Tal2E4", TYPE_UENUM, 255, ' ' },
+{ "Tal2E5", TYPE_SENUM, 32767, ' ' },
+{ "Tal2E6", TYPE_UENUM, 65535, ' ' },
+{ "Tal2E7", TYPE_SENUM, 2147483647, ' ' },
+{ "Tal2E8", TYPE_UENUM, 4294967295U, ' ' },
+{ "Tal2E9", TYPE_SENUM, 1099511627775LL, ' ' },
+{ "Tal4char", TYPE_UINT, 127, 'C' },
+{ "Tal4schar", TYPE_INT, 127, 'C' },
+{ "Tal4uchar", TYPE_UINT, 255, 'C' },
+{ "Tal4short", TYPE_INT, 32767, 'S' },
+{ "Tal4ushort", TYPE_UINT, 65535, 'S' },
+{ "Tal4int", TYPE_INT, 2147483647, 'I' },
+{ "Tal4uint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tal4long", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Tal4ulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Tal4llong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Tal4ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Tal4bool", TYPE_UINT, 1, 'B' },
+{ "Tal4ptr", TYPE_PTR, 0, 0 },
+{ "Tal4cptr", TYPE_PTR, 0, 0 },
+{ "Tal4iptr", TYPE_PTR, 0, 0 },
+{ "Tal4float", TYPE_FLOAT, 0, 0 },
+{ "Tal4double", TYPE_FLOAT, 0, 0 },
+{ "Tal4ldouble", TYPE_FLOAT, 0, 0 },
+{ "Tal4E0", TYPE_UENUM, 0, ' ' },
+{ "Tal4E1", TYPE_UENUM, 1, ' ' },
+{ "Tal4E2", TYPE_SENUM, 3, ' ' },
+{ "Tal4E3", TYPE_SENUM, 127, ' ' },
+{ "Tal4E4", TYPE_UENUM, 255, ' ' },
+{ "Tal4E5", TYPE_SENUM, 32767, ' ' },
+{ "Tal4E6", TYPE_UENUM, 65535, ' ' },
+{ "Tal4E7", TYPE_SENUM, 2147483647, ' ' },
+{ "Tal4E8", TYPE_UENUM, 4294967295U, ' ' },
+{ "Tal4E9", TYPE_SENUM, 1099511627775LL, ' ' },
+{ "Tal8char", TYPE_UINT, 127, 'C' },
+{ "Tal8schar", TYPE_INT, 127, 'C' },
+{ "Tal8uchar", TYPE_UINT, 255, 'C' },
+{ "Tal8short", TYPE_INT, 32767, 'S' },
+{ "Tal8ushort", TYPE_UINT, 65535, 'S' },
+{ "Tal8int", TYPE_INT, 2147483647, 'I' },
+{ "Tal8uint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tal8long", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Tal8ulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Tal8llong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Tal8ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Tal8bool", TYPE_UINT, 1, 'B' },
+{ "Tal8ptr", TYPE_PTR, 0, 0 },
+{ "Tal8cptr", TYPE_PTR, 0, 0 },
+{ "Tal8iptr", TYPE_PTR, 0, 0 },
+{ "Tal8float", TYPE_FLOAT, 0, 0 },
+{ "Tal8double", TYPE_FLOAT, 0, 0 },
+{ "Tal8ldouble", TYPE_FLOAT, 0, 0 },
+{ "Tal8E0", TYPE_UENUM, 0, ' ' },
+{ "Tal8E1", TYPE_UENUM, 1, ' ' },
+{ "Tal8E2", TYPE_SENUM, 3, ' ' },
+{ "Tal8E3", TYPE_SENUM, 127, ' ' },
+{ "Tal8E4", TYPE_UENUM, 255, ' ' },
+{ "Tal8E5", TYPE_SENUM, 32767, ' ' },
+{ "Tal8E6", TYPE_UENUM, 65535, ' ' },
+{ "Tal8E7", TYPE_SENUM, 2147483647, ' ' },
+{ "Tal8E8", TYPE_UENUM, 4294967295U, ' ' },
+{ "Tal8E9", TYPE_SENUM, 1099511627775LL, ' ' },
+{ "Tal16char", TYPE_UINT, 127, 'C' },
+{ "Tal16schar", TYPE_INT, 127, 'C' },
+{ "Tal16uchar", TYPE_UINT, 255, 'C' },
+{ "Tal16short", TYPE_INT, 32767, 'S' },
+{ "Tal16ushort", TYPE_UINT, 65535, 'S' },
+{ "Tal16int", TYPE_INT, 2147483647, 'I' },
+{ "Tal16uint", TYPE_UINT, 4294967295U, 'I' },
+{ "Tal16long", TYPE_INT, 9223372036854775807LL, 'L' },
+{ "Tal16ulong", TYPE_UINT, 18446744073709551615ULL, 'L' },
+{ "Tal16llong", TYPE_INT, 9223372036854775807LL, 'Q' },
+{ "Tal16ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' },
+{ "Tal16bool", TYPE_UINT, 1, 'B' },
+{ "Tal16ptr", TYPE_PTR, 0, 0 },
+{ "Tal16cptr", TYPE_PTR, 0, 0 },
+{ "Tal16iptr", TYPE_PTR, 0, 0 },
+{ "Tal16float", TYPE_FLOAT, 0, 0 },
+{ "Tal16double", TYPE_FLOAT, 0, 0 },
+{ "Tal16ldouble", TYPE_FLOAT, 0, 0 },
+{ "Tal16E0", TYPE_UENUM, 0, ' ' },
+{ "Tal16E1", TYPE_UENUM, 1, ' ' },
+{ "Tal16E2", TYPE_SENUM, 3, ' ' },
+{ "Tal16E3", TYPE_SENUM, 127, ' ' },
+{ "Tal16E4", TYPE_UENUM, 255, ' ' },
+{ "Tal16E5", TYPE_SENUM, 32767, ' ' },
+{ "Tal16E6", TYPE_UENUM, 65535, ' ' },
+{ "Tal16E7", TYPE_SENUM, 2147483647, ' ' },
+{ "Tal16E8", TYPE_UENUM, 4294967295U, ' ' },
+{ "Tal16E9", TYPE_SENUM, 1099511627775LL, ' ' }
+#define NATYPES2 (sizeof (attrib_types) / sizeof (attrib_types[0]))
+};
+struct types complex_attrib_types[] = {
+{ "Talcchar", TYPE_CUINT, 127, 0 },
+{ "Talcschar", TYPE_CINT, 127, 0 },
+{ "Talcuchar", TYPE_CUINT, 255, 0 },
+{ "Talcshort", TYPE_CINT, 32767, 0 },
+{ "Talcushort", TYPE_CUINT, 65535, 0 },
+{ "Talcint", TYPE_CINT, 2147483647, 0 },
+{ "Talcuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Talclong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Talculong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Talcllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Talcullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Talcfloat", TYPE_CFLOAT, 0, 0 },
+{ "Talcdouble", TYPE_CFLOAT, 0, 0 },
+{ "Talcldouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal1cchar", TYPE_CUINT, 127, 0 },
+{ "Tal1cschar", TYPE_CINT, 127, 0 },
+{ "Tal1cuchar", TYPE_CUINT, 255, 0 },
+{ "Tal1cshort", TYPE_CINT, 32767, 0 },
+{ "Tal1cushort", TYPE_CUINT, 65535, 0 },
+{ "Tal1cint", TYPE_CINT, 2147483647, 0 },
+{ "Tal1cuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Tal1clong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal1culong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal1cllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal1cullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal1cfloat", TYPE_CFLOAT, 0, 0 },
+{ "Tal1cdouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal1cldouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal2cchar", TYPE_CUINT, 127, 0 },
+{ "Tal2cschar", TYPE_CINT, 127, 0 },
+{ "Tal2cuchar", TYPE_CUINT, 255, 0 },
+{ "Tal2cshort", TYPE_CINT, 32767, 0 },
+{ "Tal2cushort", TYPE_CUINT, 65535, 0 },
+{ "Tal2cint", TYPE_CINT, 2147483647, 0 },
+{ "Tal2cuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Tal2clong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal2culong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal2cllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal2cullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal2cfloat", TYPE_CFLOAT, 0, 0 },
+{ "Tal2cdouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal2cldouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal4cchar", TYPE_CUINT, 127, 0 },
+{ "Tal4cschar", TYPE_CINT, 127, 0 },
+{ "Tal4cuchar", TYPE_CUINT, 255, 0 },
+{ "Tal4cshort", TYPE_CINT, 32767, 0 },
+{ "Tal4cushort", TYPE_CUINT, 65535, 0 },
+{ "Tal4cint", TYPE_CINT, 2147483647, 0 },
+{ "Tal4cuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Tal4clong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal4culong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal4cllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal4cullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal4cfloat", TYPE_CFLOAT, 0, 0 },
+{ "Tal4cdouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal4cldouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal8cchar", TYPE_CUINT, 127, 0 },
+{ "Tal8cschar", TYPE_CINT, 127, 0 },
+{ "Tal8cuchar", TYPE_CUINT, 255, 0 },
+{ "Tal8cshort", TYPE_CINT, 32767, 0 },
+{ "Tal8cushort", TYPE_CUINT, 65535, 0 },
+{ "Tal8cint", TYPE_CINT, 2147483647, 0 },
+{ "Tal8cuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Tal8clong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal8culong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal8cllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal8cullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal8cfloat", TYPE_CFLOAT, 0, 0 },
+{ "Tal8cdouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal8cldouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal16cchar", TYPE_CUINT, 127, 0 },
+{ "Tal16cschar", TYPE_CINT, 127, 0 },
+{ "Tal16cuchar", TYPE_CUINT, 255, 0 },
+{ "Tal16cshort", TYPE_CINT, 32767, 0 },
+{ "Tal16cushort", TYPE_CUINT, 65535, 0 },
+{ "Tal16cint", TYPE_CINT, 2147483647, 0 },
+{ "Tal16cuint", TYPE_CUINT, 4294967295U, 0 },
+{ "Tal16clong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal16culong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal16cllong", TYPE_CINT, 9223372036854775807LL, 0 },
+{ "Tal16cullong", TYPE_CUINT, 18446744073709551615ULL, 0 },
+{ "Tal16cfloat", TYPE_CFLOAT, 0, 0 },
+{ "Tal16cdouble", TYPE_CFLOAT, 0, 0 },
+{ "Tal16cldouble", TYPE_CFLOAT, 0, 0 }
+#define NCATYPES2 (sizeof (complex_attrib_types) / sizeof (complex_attrib_types[0]))
+};
+
+struct types bitfld_types[NTYPES2];
+int n_bitfld_types;
+struct types aligned_bitfld_types[NATYPES2];
+int n_aligned_bitfld_types;
+
+const char *attributes[] = {
+"atal", 
+"atpa", 
+"atal1", 
+"atal2", 
+"atal4", 
+"atal8", 
+"atal16", 
+#define NATTRIBS1 7
+"atalpa", 
+"atpaal", 
+"atal1pa", 
+"atal2pa", 
+"atal4pa", 
+"atal8pa", 
+"atal16pa", 
+"atpaal1", 
+"atpaal2", 
+"atpaal4", 
+"atpaal8", 
+"atpaal16"
+#define NATTRIBS2 (sizeof (attributes) / sizeof (attributes[0]))
+};
+
+enum ETYPE
+{
+  ETYPE_TYPE,
+  ETYPE_ARRAY,
+  ETYPE_BITFLD,
+  ETYPE_STRUCT,
+  ETYPE_UNION,
+  ETYPE_STRUCT_ARRAY,
+  ETYPE_UNION_ARRAY
+};
+
+struct entry
+{
+#ifdef __GNUC__
+  enum ETYPE etype : 8;
+#else
+  unsigned char etype;
+#endif
+  unsigned short len;
+  unsigned char arr_len;
+  struct types *type;
+  const char *attrib;
+};
+
+static int idx, limidx, output_one;
+static const char *destdir;
+static const char *srcdir;
+FILE *outfile;
+
+void
+switchfiles (int fields)
+{
+  static int filecnt;
+  static char *destbuf, *destptr;
+  ++filecnt;
+  if (outfile)
+    fclose (outfile);
+  if (output_one)
+    {
+      outfile = stdout;
+      return;
+    }
+  if (destbuf == NULL)
+    {
+      size_t len = strlen (destdir);
+      destbuf = xmalloc (len + 20);
+      memcpy (destbuf, destdir, len);
+      if (!len || destbuf[len - 1] != '/')
+	destbuf[len++] = '/';
+      destptr = destbuf + len;
+    }
+  sprintf (destptr, "t%03d_main.c", filecnt);
+  outfile = fopen (destbuf, "w");
+  if (outfile == NULL)
+    {
+    fail:
+      fputs ("failed to create test files\n", stderr);
+      exit (1);
+    }
+  fprintf (outfile, "\
+/* { dg-options \"-I%s\" } */\n\
+#include \"struct-layout-1.h\"\n\
+\n\
+#define TX(n, type, attrs, fields, ops) extern void test##n (void);\n\
+#include \"t%03d_test.h\"\n\
+#undef TX\n\
+\n\
+int main (void)\n\
+{\n\
+#define TX(n, type, attrs, fields, ops)   test##n ();\n\
+#include \"t%03d_test.h\"\n\
+#undef TX\n\
+  if (fails)\n\
+    abort ();\n\
+  exit (0);\n\
+}\n", srcdir, filecnt, filecnt);
+  fclose (outfile);
+  sprintf (destptr, "t%03d_x.c", filecnt);
+  outfile = fopen (destbuf, "w");
+  if (outfile == NULL)
+    goto fail;
+  fprintf (outfile, "\
+/* { dg-options \"-w -I%s\" } */\n\
+#include \"struct-layout-1_x1.h\"\n\
+#include \"t%03d_test.h\"\n\
+#include \"struct-layout-1_x2.h\"\n\
+#include \"t%03d_test.h\"\n", srcdir, filecnt, filecnt);
+  fclose (outfile);
+  sprintf (destptr, "t%03d_y.c", filecnt);
+  outfile = fopen (destbuf, "w");
+  if (outfile == NULL)
+    goto fail;
+  fprintf (outfile, "\
+/* { dg-options \"-w -I%s\" } */\n\
+#include \"struct-layout-1_y1.h\"\n\
+#include \"t%03d_test.h\"\n\
+#include \"struct-layout-1_y2.h\"\n\
+#include \"t%03d_test.h\"\n", srcdir, filecnt, filecnt);
+  fclose (outfile);
+  sprintf (destptr, "t%03d_test.h", filecnt);
+  outfile = fopen (destbuf, "w");
+  if (outfile == NULL)
+    goto fail;
+  if (fields <= 2)
+    limidx = idx + 300;
+  else if (fields <= 4)
+    limidx = idx + 200;
+  else if (fields <= 6)
+    limidx = idx + 100;
+  else
+    limidx = idx + 50;
+}
+
+unsigned long long int
+getrandll (void)
+{
+  unsigned long long int ret;
+  ret = generate_random () & 0xffffff;
+  ret |= (generate_random () & 0xffffffLL) << 24;
+  ret |= ((unsigned long long int) generate_random ()) << 48;
+  return ret;
+}
+
+int
+subfield (struct entry *e, char *letter)
+{
+  int i, type;
+  char buf[20];
+  const char *p;
+  switch (e[0].etype)
+    {
+    case ETYPE_STRUCT:
+    case ETYPE_UNION:
+    case ETYPE_STRUCT_ARRAY:
+    case ETYPE_UNION_ARRAY:
+      type = e[0].attrib ? 1 + (generate_random () & 3) : 0;
+      if (e[0].etype == ETYPE_STRUCT || e[0].etype == ETYPE_STRUCT_ARRAY)
+	p = "struct";
+      else
+	p = "union";
+      if (e[0].etype == ETYPE_STRUCT_ARRAY || e[0].etype == ETYPE_UNION_ARRAY)
+	{
+	  if (e[0].arr_len == 255)
+	    snprintf (buf, 20, "%c[]", *letter);
+	  else
+	    snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len);
+	}
+      else
+        {
+          buf[0] = *letter;
+          buf[1] = '\0';
+        }
+      ++*letter;
+      switch (type)
+        {
+        case 0:
+        case 3:
+        case 4:
+          fprintf (outfile, "%s{", p);
+          break;
+        case 1:
+          fprintf (outfile, "%s %s{", e[0].attrib, p);
+          break;
+        case 2:
+          fprintf (outfile, "%s %s{", p, e[0].attrib);
+          break;
+        }
+
+      for (i = 1; i <= e[0].len; )
+	i += subfield (e + i, letter);
+
+      switch (type)
+        {
+        case 0:
+        case 1:
+        case 2:
+          fprintf (outfile, "}%s;", buf);
+          break;
+	case 3:
+	  fprintf (outfile, "}%s %s;", e[0].attrib, buf);
+	  break;
+	case 4:
+	  fprintf (outfile, "}%s %s;", buf, e[0].attrib);
+	  break;
+        }
+      return 1 + e[0].len;
+    case ETYPE_TYPE:
+    case ETYPE_ARRAY:
+      if (e[0].etype == ETYPE_ARRAY)
+	{
+	  if (e[0].arr_len == 255)
+	    snprintf (buf, 20, "%c[]", *letter);
+	  else
+	    snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len);
+	}
+      else
+        {
+          buf[0] = *letter;
+          buf[1] = '\0';
+        }
+      ++*letter;
+      if (e[0].attrib)
+	switch (generate_random () % 3)
+          {
+          case 0:
+            fprintf (outfile, "%s %s %s;", e[0].attrib, e[0].type->name, buf);
+            break;
+          case 1:
+            fprintf (outfile, "%s %s %s;", e[0].type->name, e[0].attrib, buf);
+            break;
+          case 2:
+            fprintf (outfile, "%s %s %s;", e[0].type->name, buf, e[0].attrib);
+            break;
+          }
+      else
+	fprintf (outfile, "%s %s;", e[0].type->name, buf);
+      return 1;
+    case ETYPE_BITFLD:
+      if (e[0].len == 0)
+	{
+	  if (e[0].attrib)
+	    switch (generate_random () % 3)
+	      {
+	      case 0:
+		fprintf (outfile, "%s %s:0;", e[0].attrib, e[0].type->name);
+		break;
+	      case 1:
+		fprintf (outfile, "%s %s:0;", e[0].type->name, e[0].attrib);
+		break;
+	      case 2:
+		fprintf (outfile, "%s:0 %s;", e[0].type->name, e[0].attrib);
+		break;
+	      }
+	  else
+	    fprintf (outfile, "%s:0;", e[0].type->name);
+	  ++*letter;
+	  return 1;
+	}
+      switch (e[0].type->bitfld)
+	{
+	case 'C':
+	case 'S':
+	case 'I':
+	case 'L':
+	case 'Q':
+	  snprintf (buf, 20, "B%cN(%d)", e[0].type->bitfld, e[0].len);
+	  break;
+	case 'B':
+	case ' ':
+	  snprintf (buf, 20, "%d", e[0].len);
+	  break;
+	default:
+	  abort ();
+	}
+      if (e[0].attrib)
+	switch (generate_random () % 3)
+	  {
+	  case 0:
+	    fprintf (outfile, "%s %s %c:%s;", e[0].attrib, e[0].type->name,
+		     *letter, buf);
+	    break;
+	  case 1:
+	    fprintf (outfile, "%s %s %c:%s;", e[0].type->name, e[0].attrib,
+		     *letter, buf);
+	    break;
+	  case 2:
+	    fprintf (outfile, "%s %c:%s %s;", e[0].type->name, *letter,
+		     buf, e[0].attrib);
+	    break;
+	  }
+      else
+	fprintf (outfile, "%s %c:%s;", e[0].type->name, *letter, buf);
+      ++*letter;
+      return 1;
+    default:
+      abort ();
+  }
+}
+
+char namebuf[1024];
+
+void
+output_FNB (char mode, struct entry *e)
+{
+  unsigned long long int l1, l2, m;
+  int signs = 0;
+  const char *p, *q;
+
+  if (e->type->type == TYPE_OTHER)
+    {
+      if (mode == 'B')
+        abort ();
+      fprintf (outfile, "N(%d,%s)", idx, namebuf);
+      return;
+    }
+  fprintf (outfile, "%c(%d,%s,", mode, idx, namebuf);
+  l1 = getrandll ();
+  l2 = getrandll ();
+  switch (e->type->type)
+    {
+    case TYPE_INT:
+      signs = generate_random () & 3;
+      m = e->type->maxval;
+      if (mode == 'B')
+	m &= e->len > 1 ? (1ULL << (e->len - 1)) - 1 : 1;
+      l1 &= m;
+      l2 &= m;
+      fprintf (outfile, "%s%llu%s,%s%llu%s",
+	       (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "",
+	       (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : "");
+      break;
+    case TYPE_UINT:
+      m = e->type->maxval;
+      if (mode == 'B')
+	m &= (1ULL << e->len) - 1;
+      l1 &= m;
+      l2 &= m;
+      fprintf (outfile, "%lluU%s,%lluU%s", l1, l1 > 4294967295U ? "LL" : "",
+	       l2, l2 > 4294967295U ? "LL" : "");
+      break;
+    case TYPE_FLOAT:
+      l1 &= 0xffffff;
+      l2 &= 0xffffff;
+      signs = generate_random () & 3;
+      fprintf (outfile, "%s%f,%s%f", (signs & 1) ? "-" : "",
+	       ((double) l1) / 64, (signs & 2) ? "-" : "", ((double) l2) / 64);
+      break;
+    case TYPE_CINT:
+      signs = generate_random () & 3;
+      l1 &= e->type->maxval;
+      l2 &= e->type->maxval;
+      fprintf (outfile, "CINT(%s%llu%s,%s%llu%s),",
+	       (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "",
+	       (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : "");
+      signs = generate_random () & 3;
+      l1 = getrandll ();
+      l2 = getrandll ();
+      l1 &= e->type->maxval;
+      l2 &= e->type->maxval;
+      fprintf (outfile, "CINT(%s%llu%s,%s%llu%s)",
+	       (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "",
+	       (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : "");
+      break;
+    case TYPE_CUINT:
+      l1 &= e->type->maxval;
+      l2 &= e->type->maxval;
+      fprintf (outfile, "CINT(%lluU%s,%lluU%s),",
+	       l1, l1 > 4294967295U ? "LL" : "",
+	       l2, l2 > 4294967295U ? "LL" : "");
+      l1 = getrandll ();
+      l2 = getrandll ();
+      l1 &= e->type->maxval;
+      l2 &= e->type->maxval;
+      fprintf (outfile, "CINT(%lluU%s,%lluU%s)",
+	       l1, l1 > 4294967295U ? "LL" : "",
+	       l2, l2 > 4294967295U ? "LL" : "");
+      break;
+    case TYPE_CFLOAT:
+      l1 &= 0xffffff;
+      l2 &= 0xffffff;
+      signs = generate_random () & 3;
+      fprintf (outfile, "CDBL(%s%f,%s%f),",
+	       (signs & 1) ? "-" : "", ((double) l1) / 64,
+	       (signs & 2) ? "-" : "", ((double) l2) / 64);
+      l1 = getrandll ();
+      l2 = getrandll ();
+      l1 &= 0xffffff;
+      l2 &= 0xffffff;
+      signs = generate_random () & 3;
+      fprintf (outfile, "CDBL(%s%f,%s%f)",
+	       (signs & 1) ? "-" : "", ((double) l1) / 64,
+	       (signs & 2) ? "-" : "", ((double) l2) / 64);
+      break;
+    case TYPE_UENUM:
+      if (e->type->maxval == 0)
+	fputs ("e0_0,e0_0", outfile);
+      else if (e->type->maxval == 1)
+        fprintf (outfile, "e1_%lld,e1_%lld", l1 & 1, l2 & 1);
+      else
+        {
+	  p = strchr (e->type->name, '\0');
+	  while (--p >= e->type->name && *p >= '0' && *p <= '9');
+	  p++;
+          l1 %= 7;
+          l2 %= 7;
+          if (l1 > 3)
+            l1 += e->type->maxval - 6;
+          if (l2 > 3)
+            l2 += e->type->maxval - 6;
+	  fprintf (outfile, "e%s_%lld,e%s_%lld", p, l1, p, l2);
+        }
+      break;
+    case TYPE_SENUM:
+      p = strchr (e->type->name, '\0');
+      while (--p >= e->type->name && *p >= '0' && *p <= '9');
+      p++;
+      l1 %= 7;
+      l2 %= 7;
+      fprintf (outfile, "e%s_%s%lld,e%s_%s%lld",
+	       p, l1 < 3 ? "m" : "",
+	       l1 == 3 ? 0LL : e->type->maxval - (l1 & 3),
+	       p, l2 < 3 ? "m" : "",
+	       l2 == 3 ? 0LL : e->type->maxval - (l2 & 3));
+      break;
+    case TYPE_PTR:
+      l1 %= 256;
+      l2 %= 256;
+      fprintf (outfile, "(%s)&intarray[%lld],(%s)&intarray[%lld]",
+	       e->type->name, l1, e->type->name, l2);
+      break;
+    case TYPE_FNPTR:
+      l1 %= 10;
+      l2 %= 10;
+      fprintf (outfile, "fn%lld,fn%lld", l1, l2);
+      break;
+    default:
+      abort ();
+    }
+  fputs (")", outfile);
+}
+
+int
+subvalues (struct entry *e, char *p, char *letter)
+{
+  int i, j;
+  char *q;
+  if (p >= namebuf + sizeof (namebuf) - 32)
+    abort ();
+  p[0] = *letter;
+  p[1] = '\0';
+  q = p + 1;
+  switch (e[0].etype)
+    {
+    case ETYPE_STRUCT_ARRAY:
+    case ETYPE_UNION_ARRAY:
+      if (e[0].arr_len == 0 || e[0].arr_len == 255)
+	{
+	  *letter += 1 + e[0].len;
+	  return 1 + e[0].len;
+	}
+      i = generate_random () % e[0].arr_len;
+      snprintf (p, sizeof (namebuf) - (p - namebuf) - 1,
+		"%c[%d]", *letter, i);
+      q = strchr (p, '\0');
+      /* FALLTHROUGH */
+    case ETYPE_STRUCT:
+    case ETYPE_UNION:
+      *q++ = '.';
+      ++*letter;
+      for (i = 1; i <= e[0].len; )
+	{
+	  i += subvalues (e + i, q, letter);
+	  if (e[0].etype == ETYPE_UNION || e[0].etype == ETYPE_UNION_ARRAY)
+	    {
+	      *letter += e[0].len - i + 1;
+	      break;
+	    }
+	}
+      return 1 + e[0].len;
+    case ETYPE_TYPE:
+      ++*letter;
+      output_FNB ('F', e);
+      return 1;
+    case ETYPE_ARRAY:
+      if (e[0].arr_len == 0 || e[0].arr_len == 255)
+	{
+	  ++*letter;
+	  return 1;
+	}
+      i = generate_random () % e[0].arr_len;
+      snprintf (p, sizeof (namebuf) - (p - namebuf),
+		"%c[%d]", *letter, i);
+      output_FNB ('F', e);
+      if ((generate_random () & 7) == 0)
+	{
+	  j = generate_random () % e[0].arr_len;
+	  if (i != j)
+	    {
+	      snprintf (p, sizeof (namebuf) - (p - namebuf),
+			"%c[%d]", *letter, j);
+	      output_FNB ('F', e);
+	    }
+	}
+      ++*letter;
+      return 1;
+    case ETYPE_BITFLD:
+      ++*letter;
+      if (e[0].len != 0)
+	output_FNB ('B', e);
+      return 1;
+    }
+}
+
+hashval_t
+e_hash (const void *a)
+{
+  const struct entry *e = a;
+  hashval_t ret = 0;
+  int i;
+
+  if (e[0].etype != ETYPE_STRUCT && e[0].etype != ETYPE_UNION)
+    abort ();
+  for (i = 0; i <= e[0].len; ++i)
+    {
+      int attriblen;
+      ret = iterative_hash (&e[i], offsetof (struct entry, attrib), ret);
+      attriblen = e[i].attrib ? strlen (e[i].attrib) : -1;
+      ret = iterative_hash (&attriblen, sizeof (int), ret);
+      if (e[i].attrib)
+        ret = iterative_hash (e[i].attrib, attriblen, ret);
+    }
+  return ret;
+}
+
+int
+e_eq (const void *a, const void *b)
+{
+  const struct entry *ea = a, *eb = b;
+  int i;
+  if (ea[0].etype != ETYPE_STRUCT && ea[0].etype != ETYPE_UNION)
+    abort ();
+  if (ea[0].len != eb[0].len)
+    return 0;
+  for (i = 0; i <= ea[0].len; ++i)
+    {
+      if (ea[i].etype != eb[i].etype
+	  || ea[i].len != eb[i].len
+	  || ea[i].arr_len != eb[i].arr_len
+	  || ea[i].type != eb[i].type)
+	return 0;
+      if ((ea[i].attrib == NULL) ^ (eb[i].attrib == NULL))
+	return 0;
+      if (ea[i].attrib && strcmp (ea[i].attrib, eb[i].attrib) != 0)
+	return 0;
+    }
+  return 1;
+}
+
+htab_t hasht;
+
+void
+output (struct entry *e)
+{
+  int i;
+  char c;
+  void **p;
+  const char *skip_cint = "";
+
+  if (e[0].etype != ETYPE_STRUCT && e[0].etype != ETYPE_UNION)
+    abort ();
+
+  p = htab_find_slot (hasht, e, INSERT);
+  if (*p != NULL)
+    return;
+
+  *p = malloc ((e[0].len + 1) * sizeof (struct entry));
+  memcpy (*p, e, (e[0].len + 1) * sizeof (struct entry));
+
+  if (idx == limidx)
+    switchfiles (e[0].len);
+
+  for (i = 1; i <= e[0].len; ++i)
+    if ((e[i].etype == ETYPE_TYPE || e[i].etype == ETYPE_ARRAY)
+	&& (e[i].type->type == TYPE_CINT || e[i].type->type == TYPE_CUINT))
+      break;
+  if (i <= e[0].len)
+    skip_cint = "CI";
+  if (e[0].attrib)
+    fprintf (outfile, (generate_random () & 1)
+	     ? "TX%s(%d,%s %s,," : "TX%s(%d,%s,%s,", skip_cint,
+	     idx, e[0].etype == ETYPE_STRUCT ? "struct" : "union",
+	     e[0].attrib);
+  else if (e[0].etype == ETYPE_STRUCT)
+    fprintf (outfile, "T%s(%d,", skip_cint, idx);
+  else
+    fprintf (outfile, "U%s(%d,", skip_cint, idx);
+  c = 'a';
+  for (i = 1; i <= e[0].len; )
+    i += subfield (e + i, &c);
+  fputs (",", outfile);
+  c = 'a';
+  for (i = 1; i <= e[0].len; )
+    {
+      i += subvalues (e + i, namebuf, &c);
+      if (e[0].etype == ETYPE_UNION)
+        break;
+    }
+  fputs (")\n", outfile);
+  if (output_one && idx == limidx)
+    exit (0);
+  ++idx;
+}
+
+enum FEATURE
+{
+  FEATURE_VECTOR = 1,
+  FEATURE_COMPLEX = 2,
+  FEATURE_ALIGNEDPACKED = 4,
+  FEATURE_ZEROARRAY = 8,
+  FEATURE_ZEROBITFLD = 16,
+  ALL_FEATURES = FEATURE_COMPLEX | FEATURE_VECTOR | FEATURE_ZEROARRAY
+		 | FEATURE_ALIGNEDPACKED | FEATURE_ZEROBITFLD
+};
+
+void
+singles (enum FEATURE features)
+{
+  struct entry e[2];
+  int i;
+  memset (e, 0, sizeof (e));
+  e[0].etype = ETYPE_STRUCT;
+  output (e);
+  e[0].etype = ETYPE_UNION;
+  output (e);
+  for (i = 0;
+       i < ((features & FEATURE_ALIGNEDPACKED) ? NATTRIBS2 : NATTRIBS1);
+       ++i)
+    {
+      e[0].attrib = attributes[i];
+      e[0].etype = ETYPE_STRUCT;
+      output (e);
+      e[0].etype = ETYPE_UNION;
+      output (e);
+    }
+  e[0].len = 1;
+  e[0].attrib = NULL;
+  for (i = 0; i < NTYPES2; ++i)
+    {
+      e[0].etype = ETYPE_STRUCT;
+      e[1].etype = ETYPE_TYPE;
+      e[1].type = &base_types[i];
+      output (e);
+      e[0].etype = ETYPE_UNION;
+      output (e);
+    }
+  if (features & FEATURE_COMPLEX)
+    for (i = 0; i < NCTYPES2; ++i)
+      {
+	e[0].etype = ETYPE_STRUCT;
+	e[1].etype = ETYPE_TYPE;
+	e[1].type = &complex_types[i];
+	output (e);
+	e[0].etype = ETYPE_UNION;
+	output (e);
+      }
+  if (features & FEATURE_VECTOR)
+    for (i = 0; i < NVTYPES2; ++i)
+      {
+	e[0].etype = ETYPE_STRUCT;
+	e[1].etype = ETYPE_TYPE;
+	e[1].type = &vector_types[i];
+	output (e);
+	e[0].etype = ETYPE_UNION;
+	output (e);
+      }
+}
+
+void
+choose_type (enum FEATURE features, struct entry *e, int r)
+{
+  int i;
+
+  i = NTYPES2 - NTYPES1;
+  if (features & FEATURE_COMPLEX)
+    i += NCTYPES2;
+  if (features & FEATURE_VECTOR)
+    i += NVTYPES2;
+  if ((r & 3) == 0)
+    {
+      i += NATYPES2;
+      if (features & FEATURE_COMPLEX)
+        i += NCATYPES2;
+    }
+  r >>= 2;
+  r %= i;
+  if (r < NTYPES2 - NTYPES1)
+    e->type = &base_types[r + NTYPES1];
+  r -= NTYPES2 - NTYPES1;
+  if (e->type == NULL && (features & FEATURE_COMPLEX))
+    {
+      if (r < NCTYPES2)
+	e->type = &complex_types[r];
+      r -= NCTYPES2;
+    }
+  if (e->type == NULL && (features & FEATURE_VECTOR))
+    {
+      if (r < NVTYPES2)
+	e->type = &vector_types[r];
+      r -= NVTYPES2;
+    }
+  if (e->type == NULL)
+    {
+      if (r < NATYPES2)
+	e->type = &attrib_types[r];
+      r -= NATYPES2;
+    }
+  if (e->type == NULL && (features & FEATURE_COMPLEX))
+    {
+      if (r < NCATYPES2)
+	e->type = &complex_attrib_types[r];
+      r -= NCATYPES2;
+    }
+  if (e->type == NULL)
+    abort ();
+}
+
+void
+generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
+		 int len)
+{
+  int r, i, j, ret = 1, n, incr, sametype;
+
+  for (n = 0; n < len; n += incr)
+    {
+      r = generate_random ();
+      /* 50% ETYPE_TYPE base_types NTYPES1
+	 12.5% ETYPE_TYPE other
+	 12.5% ETYPE_ARRAY
+	 12.5% ETYPE_BITFLD
+	 12.5% ETYPE_STRUCT|ETYPE_UNION|ETYPE_STRUCT_ARRAY|ETYPE_UNION_ARRAY */
+      i = (r & 7);
+      r >>= 3;
+      incr = 1;
+      switch (i)
+	{
+	case 0:
+	case 1:
+	case 2:
+	case 3:
+	  e[n].etype = ETYPE_TYPE;
+	  e[n].type = &base_types[r % NTYPES1];
+	  break;
+	case 4:
+	  e[n].etype = ETYPE_TYPE;
+	  choose_type (features, &e[n], r);
+	  break;
+	case 5:
+	  e[n].etype = ETYPE_ARRAY;
+	  i = r & 1;
+	  r >>= 1;
+	  if (i)
+	    e[n].type = &base_types[r % NTYPES1];
+	  else
+	    choose_type (features, &e[n], r);
+	  r = generate_random ();
+	  if ((features & FEATURE_ZEROARRAY) && (r & 3) == 0)
+	    {
+	      e[n].arr_len = 0;
+	      if (n == len - 1 && (r & 4)
+		  && (parent->etype == ETYPE_STRUCT
+		      || parent->etype == ETYPE_STRUCT_ARRAY))
+		{
+		  int k;
+		  for (k = 0; k < n; ++k)
+		    if (e[k].etype != ETYPE_BITFLD || e[k].len)
+		      {
+			e[n].arr_len = 255;
+			break;
+		      }
+		}
+	    }
+	  else if ((r & 3) != 3)
+	    e[n].arr_len = (r >> 2) & 7;
+	  else
+	    e[n].arr_len = (r >> 2) & 31;
+	  break;
+	case 6:
+	  sametype = 1;
+	  switch (r & 7)
+	    {
+	    case 0:
+	    case 1:
+	    case 2:
+	      break;
+	    case 3:
+	    case 4:
+	    case 5:
+	      incr = 1 + (r >> 3) % (len - n);
+	      break;
+	    case 6:
+	    case 7:
+	      sametype = 0;
+	      incr = 1 + (r >> 3) % (len - n);
+	      break;
+	    }
+	  for (j = n; j < n + incr; ++j)
+	    {
+	      int mi, ma;
+
+	      e[j].etype = ETYPE_BITFLD;
+	      if (j == n || !sametype)
+		{
+		  int k;
+		  r = generate_random ();
+		  k = r & 3;
+		  r >>= 2;
+		  if (!k)
+		    e[j].type
+		      = &aligned_bitfld_types[r % n_aligned_bitfld_types];
+		  else
+		    e[j].type
+		      = &bitfld_types[r % n_bitfld_types];
+		}
+	      else
+		e[j].type = e[n].type;
+	      r = generate_random ();
+	      mi = 0;
+	      ma = 0;
+	      switch (e[j].type->bitfld)
+	        {
+	        case 'C': ma = 8; break;
+	        case 'S': ma = 16; break;
+	        case 'I': ma = 32; break;
+	        case 'L':
+	        case 'Q': ma = 64; break;
+	        case 'B': ma = 1; break;
+	        case ' ':
+		  if (e[j].type->type == TYPE_UENUM)
+		    mi = ffsll (e[j].type->maxval + 1) - 1;
+		  else if (e[j].type->type == TYPE_SENUM)
+		    mi = ffsll (e[j].type->maxval + 1);
+		  else
+		    abort ();
+		  if (!mi)
+		    mi = 1;
+		  if (mi <= 32)
+		    ma = 32;
+		  else
+		    ma = 64;
+		  break;
+		default:
+		  abort ();
+	        }
+	      e[j].len = ma + 1;
+	      if (sametype && (r & 3) == 0 && ma > 1)
+		{
+		  int sum = 0, k;
+		  for (k = n; k < j; ++k)
+		    sum += e[k].len;
+		  sum %= ma;
+		  e[j].len = sum ? ma - sum : ma;
+		}
+	      r >>= 2;
+	      if (! (features & FEATURE_ZEROBITFLD) && mi == 0)
+		mi = 1;
+	      if (e[j].len < mi || e[j].len > ma)
+		e[j].len = mi + (r % (ma + 1 - mi));
+	      r >>= 6;
+	      if ((features & FEATURE_ZEROBITFLD) && (r & 3) == 0
+		  && mi == 0)
+		e[j].len = 0;
+	    }
+	  break;
+	case 7:
+	  switch (r & 7)
+	    {
+	    case 0:
+	    case 1:
+	    case 2:
+	      e[n].etype = ETYPE_STRUCT;
+	      break;
+	    case 3:
+	    case 4:
+	      e[n].etype = ETYPE_UNION;
+	      break;
+	    case 5:
+	    case 6:
+	      e[n].etype = ETYPE_STRUCT_ARRAY;
+	      break;
+	    case 7:
+	      e[n].etype = ETYPE_UNION_ARRAY;
+	      break;
+	    }
+	  r >>= 3;
+	  e[n].len = r % (len - n);
+	  incr = 1 + e[n].len;
+	  generate_fields (features, &e[n + 1], &e[n], e[n].len);
+	  if (e[n].etype == ETYPE_STRUCT_ARRAY
+	      || e[n].etype == ETYPE_UNION_ARRAY)
+	    {
+	      r = generate_random ();
+	      if ((features & FEATURE_ZEROARRAY) && (r & 3) == 0)
+		{
+		  e[n].arr_len = 0;
+		  if (n + incr == len && (r & 4)
+		      && (parent->etype == ETYPE_STRUCT
+			  || parent->etype == ETYPE_STRUCT_ARRAY))
+		    {
+		      int k;
+		      for (k = 0; k < n; ++k)
+			if (e[k].etype != ETYPE_BITFLD || e[k].len)
+			  {
+			    e[n].arr_len = 255;
+			    break;
+			  }
+		    }
+		}
+	      else if ((r & 3) != 3)
+		e[n].arr_len = (r >> 2) & 7;
+	      else
+		e[n].arr_len = (r >> 2) & 31;
+	    }
+	  break;
+	}
+      r = generate_random ();
+      if ((r & 7) == 0)
+	{
+	  r >>= 3;
+	  i = (features & FEATURE_ALIGNEDPACKED) ? NATTRIBS2 : NATTRIBS1;
+	  e[n].attrib = attributes[r % i];
+	  if (! (features & FEATURE_ALIGNEDPACKED)
+	      && strcmp (e[n].attrib, "atpa") == 0
+	      && ((e[n].type >= &attrib_types[0]
+		   && e[n].type < &attrib_types[NATYPES2])
+		  || (e[n].type >= &complex_attrib_types[0]
+		      && e[n].type < &complex_attrib_types[NCATYPES2])
+		  || (e[n].type >= &aligned_bitfld_types[0]
+		      && e[n].type < &aligned_bitfld_types[n_aligned_bitfld_types])))
+	    e[n].attrib = NULL;
+	}
+    }
+}
+
+void
+generate_random_tests (enum FEATURE features, int len)
+{
+  struct entry e[len + 1];
+  int i, r;
+  if (len > 'z' - 'a' + 1)
+    abort ();
+  memset (e, 0, sizeof (e));
+  r = generate_random ();
+  if ((r & 7) == 0)
+    e[0].etype = ETYPE_UNION;
+  else
+    e[0].etype = ETYPE_STRUCT;
+  r >>= 3;
+  e[0].len = len;
+  if ((r & 31) == 0)
+    {
+      r >>= 5;
+      if (features & FEATURE_ALIGNEDPACKED)
+	r %= NATTRIBS2;
+      else
+	r %= NATTRIBS1;
+      e[0].attrib = attributes[r];
+    }
+  generate_fields (features, &e[1], &e[0], len);
+  output (e);
+}
+
+struct { const char *name; enum FEATURE f; }
+features[] = {
+{ "normal", 0 },
+{ "complex", FEATURE_COMPLEX },
+{ "vector", FEATURE_VECTOR },
+{ "[0] :0", FEATURE_ZEROARRAY | FEATURE_ZEROBITFLD },
+{ "complex vector [0]",
+  FEATURE_COMPLEX | FEATURE_VECTOR | FEATURE_ZEROARRAY },
+{ "aligned packed complex vector [0] :0",
+  FEATURE_COMPLEX | FEATURE_VECTOR | FEATURE_ZEROARRAY
+  | FEATURE_ALIGNEDPACKED | FEATURE_ZEROBITFLD },
+};
+
+int
+main (int argc, char **argv)
+{
+  int i, j, count, c, n = 3000;
+
+  if (sizeof (int) != 4 || sizeof (long long) != 8)
+    return 1;
+
+  while ((c = getopt (argc, argv, "d:i:n:s:")) != -1)
+    switch (c)
+      {
+      case 'n':
+	n = atoi (optarg);
+	break;
+      case 'd':
+	destdir = optarg;
+	break;
+      case 's':
+	srcdir = optarg;
+	break;
+      case 'i':
+	output_one = 1;
+	limidx = atoi (optarg);
+	break;
+      default:
+	goto usage;
+      }
+
+  if (output_one)
+    {
+      outfile = fopen ("/dev/null", "w");
+      if (outfile == NULL)
+        {
+	  fputs ("could not open /dev/null", stderr);
+	  return 1;
+        }
+      n = limidx + 1;
+    }
+
+  if (destdir == NULL && !output_one)
+    {
+    usage:
+      fprintf (stderr, "Usage:\n\
+%s [-s srcdir -d destdir] [-n count] [-i idx]\n\
+Either -s srcdir -d destdir or -i idx must be used\n", argv[0]);
+      return 1;
+    }
+
+  if (srcdir == NULL && !output_one)
+    goto usage;
+
+  hasht = htab_create (40000, e_hash, e_eq, NULL);
+  for (i = 0; i < NTYPES2; ++i)
+    if (base_types[i].bitfld)
+      bitfld_types[n_bitfld_types++] = base_types[i];
+  for (i = 0; i < NATYPES2; ++i)
+    if (attrib_types[i].bitfld)
+      aligned_bitfld_types[n_aligned_bitfld_types++] = attrib_types[i];
+  for (i = 0; i < sizeof (features) / sizeof (features[0]); ++i)
+    {
+      int startidx = idx;
+      if (! output_one)
+	limidx = idx;
+      if (!i)
+        count = 200;
+      else
+        count = 20;
+      for (j = 1; j <= 9; ++j)
+        while (idx < startidx + j * count)
+	  generate_random_tests (features[i].f, j);
+      while (idx < startidx + count * 10)
+	generate_random_tests (features[i].f, 10 + (generate_random () % 16));
+    }
+  for (i = 0; n > 3000 && i < sizeof (features) / sizeof (features[0]); ++i)
+    {
+      int startidx;
+      startidx = idx;
+      if (! output_one)
+	limidx = idx;
+      singles (features[i].f);
+      if (!i)
+	{
+	  count = 1000;
+	  while (idx < startidx + 1000)
+	    generate_random_tests (features[i].f, 1);
+	}
+      else
+	{
+	  startidx = idx;
+	  count = 100;
+	  while (idx < startidx + 100)
+	    generate_random_tests (features[i].f, 1);
+	}
+      startidx = idx;
+      for (j = 2; j <= 9; ++j)
+	while (idx < startidx + (j - 1) * count)
+	  generate_random_tests (features[i].f, j);
+      while (idx < startidx + count * 9)
+        generate_random_tests (features[i].f, 10 + (generate_random () % 16));
+    }
+  if (! output_one)
+    limidx = idx;
+  while (idx < n)
+    generate_random_tests (ALL_FEATURES, 1 + (generate_random () % 25));
+  fclose (outfile);
+  return 0;
+}
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_x.c.jj	2004-07-23 12:46:25.961833844 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_x.c	2004-07-23 12:46:40.534261249 +0200
@@ -0,0 +1,5 @@
+/* { dg-options "-w" } */
+#include "struct-layout-1_x1.h"
+#include "struct-layout-1_test.h"
+#include "struct-layout-1_x2.h"
+#include "struct-layout-1_test.h"
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_y.c.jj	2004-07-23 11:57:23.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_y.c	2004-07-23 12:47:04.214080965 +0200
@@ -1,5 +1,5 @@
 /* { dg-options "-w" } */
 #include "struct-layout-1_y1.h"
-#include "t001_test.h"
+#include "struct-layout-1_test.h"
 #include "struct-layout-1_y2.h"
-#include "t001_test.h"
+#include "struct-layout-1_test.h"
--- gcc/testsuite/gcc.dg/compat/generate-random_r.c.jj	2004-07-23 12:51:09.380779576 +0200
+++ gcc/testsuite/gcc.dg/compat/generate-random_r.c	2004-07-23 11:55:56.000000000 +0200
@@ -0,0 +1,391 @@
+/* 
+   Copyright (C) 1995, 2004 Free Software Foundation
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+   Copyright (C) 1983 Regents of the University of California.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   4. Neither the name of the University nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+   SUCH DAMAGE.*/
+
+/*
+ * This is derived from the Berkeley source:
+ *	@(#)random.c	5.5 (Berkeley) 7/6/88
+ * It was reworked for the GNU C Library by Roland McGrath.
+ * Rewritten to be reentrant by Ulrich Drepper, 1995
+ */
+
+#include "config.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include "libiberty.h"
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include "generate-random.h"
+
+
+/* An improved random number generation package.  In addition to the standard
+   rand()/srand() like interface, this package also has a special state info
+   interface.  The initstate() routine is called with a seed, an array of
+   bytes, and a count of how many bytes are being passed in; this array is
+   then initialized to contain information for random number generation with
+   that much state information.  Good sizes for the amount of state
+   information are 32, 64, 128, and 256 bytes.  The state can be switched by
+   calling the setstate() function with the same array as was initialized
+   with initstate().  By default, the package runs with 128 bytes of state
+   information and generates far better random numbers than a linear
+   congruential generator.  If the amount of state information is less than
+   32 bytes, a simple linear congruential R.N.G. is used.  Internally, the
+   state information is treated as an array of longs; the zeroth element of
+   the array is the type of R.N.G. being used (small integer); the remainder
+   of the array is the state information for the R.N.G.  Thus, 32 bytes of
+   state information will give 7 longs worth of state information, which will
+   allow a degree seven polynomial.  (Note: The zeroth word of state
+   information also has some other information stored in it; see setstate
+   for details).  The random number generation technique is a linear feedback
+   shift register approach, employing trinomials (since there are fewer terms
+   to sum up that way).  In this approach, the least significant bit of all
+   the numbers in the state table will act as a linear feedback shift register,
+   and will have period 2^deg - 1 (where deg is the degree of the polynomial
+   being used, assuming that the polynomial is irreducible and primitive).
+   The higher order bits will have longer periods, since their values are
+   also influenced by pseudo-random carries out of the lower bits.  The
+   total period of the generator is approximately deg*(2**deg - 1); thus
+   doubling the amount of state information has a vast influence on the
+   period of the generator.  Note: The deg*(2**deg - 1) is an approximation
+   only good for large deg, when the period of the shift register is the
+   dominant factor.  With deg equal to seven, the period is actually much
+   longer than the 7*(2**7 - 1) predicted by this formula.  */
+
+
+
+/* For each of the currently supported random number generators, we have a
+   break value on the amount of state information (you need at least this many
+   bytes of state info to support this random number generator), a degree for
+   the polynomial (actually a trinomial) that the R.N.G. is based on, and
+   separation between the two lower order coefficients of the trinomial.  */
+
+/* Linear congruential.  */
+#define	TYPE_0		0
+#define	BREAK_0		8
+#define	DEG_0		0
+#define	SEP_0		0
+
+/* x**7 + x**3 + 1.  */
+#define	TYPE_1		1
+#define	BREAK_1		32
+#define	DEG_1		7
+#define	SEP_1		3
+
+/* x**15 + x + 1.  */
+#define	TYPE_2		2
+#define	BREAK_2		64
+#define	DEG_2		15
+#define	SEP_2		1
+
+/* x**31 + x**3 + 1.  */
+#define	TYPE_3		3
+#define	BREAK_3		128
+#define	DEG_3		31
+#define	SEP_3		3
+
+/* x**63 + x + 1.  */
+#define	TYPE_4		4
+#define	BREAK_4		256
+#define	DEG_4		63
+#define	SEP_4		1
+
+
+/* Array versions of the above information to make code run faster.
+   Relies on fact that TYPE_i == i.  */
+
+#define	MAX_TYPES	5	/* Max number of types above.  */
+
+struct random_poly_info
+{
+  int seps[MAX_TYPES];
+  int degrees[MAX_TYPES];
+};
+
+static const struct random_poly_info random_poly_info =
+{
+  { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 },
+  { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }
+};
+
+
+
+
+/* Initialize the random number generator based on the given seed.  If the
+   type is the trivial no-state-information type, just remember the seed.
+   Otherwise, initializes state[] based on the given "seed" via a linear
+   congruential generator.  Then, the pointers are set to known locations
+   that are exactly rand_sep places apart.  Lastly, it cycles the state
+   information a given number of times to get rid of any initial dependencies
+   introduced by the L.C.R.N.G.  Note that the initialization of randtbl[]
+   for default usage relies on values produced by this routine.  */
+int
+generate_srandom_r (unsigned int seed, struct generate_random_data *buf)
+{
+  int type;
+  int *state;
+  long int i;
+  long int word;
+  int *dst;
+  int kc;
+
+  if (buf == NULL)
+    goto fail;
+  type = buf->rand_type;
+  if ((unsigned int) type >= MAX_TYPES)
+    goto fail;
+
+  state = buf->state;
+  /* We must make sure the seed is not 0.  Take arbitrarily 1 in this case.  */
+  if (seed == 0)
+    seed = 1;
+  state[0] = seed;
+  if (type == TYPE_0)
+    goto done;
+
+  dst = state;
+  word = seed;
+  kc = buf->rand_deg;
+  for (i = 1; i < kc; ++i)
+    {
+      /* This does:
+	   state[i] = (16807 * state[i - 1]) % 2147483647;
+	 but avoids overflowing 31 bits.  */
+      long int hi = word / 127773;
+      long int lo = word % 127773;
+      word = 16807 * lo - 2836 * hi;
+      if (word < 0)
+	word += 2147483647;
+      *++dst = word;
+    }
+
+  buf->fptr = &state[buf->rand_sep];
+  buf->rptr = &state[0];
+  kc *= 10;
+  while (--kc >= 0)
+    {
+      int discard;
+      (void) generate_random_r (buf, &discard);
+    }
+
+ done:
+  return 0;
+
+ fail:
+  return -1;
+}
+
+/* Initialize the state information in the given array of N bytes for
+   future random number generation.  Based on the number of bytes we
+   are given, and the break values for the different R.N.G.'s, we choose
+   the best (largest) one we can and set things up for it.  srandom is
+   then called to initialize the state information.  Note that on return
+   from srandom, we set state[-1] to be the type multiplexed with the current
+   value of the rear pointer; this is so successive calls to initstate won't
+   lose this information and will be able to restart with setstate.
+   Note: The first thing we do is save the current state, if any, just like
+   setstate so that it doesn't matter when initstate is called.
+   Returns a pointer to the old state.  */
+int
+generate_initstate_r (unsigned int seed, char *arg_state, size_t n,
+		      struct generate_random_data *buf)
+{
+  int type;
+  int degree;
+  int separation;
+  int *state;
+
+  if (buf == NULL)
+    goto fail;
+
+  if (n >= BREAK_3)
+    type = n < BREAK_4 ? TYPE_3 : TYPE_4;
+  else if (n < BREAK_1)
+    {
+      if (n < BREAK_0)
+	{
+	  goto fail;
+	}
+      type = TYPE_0;
+    }
+  else
+    type = n < BREAK_2 ? TYPE_1 : TYPE_2;
+
+  degree = random_poly_info.degrees[type];
+  separation = random_poly_info.seps[type];
+
+  buf->rand_type = type;
+  buf->rand_sep = separation;
+  buf->rand_deg = degree;
+  state = &((int *) arg_state)[1];	/* First location.  */
+  /* Must set END_PTR before srandom.  */
+  buf->end_ptr = &state[degree];
+
+  buf->state = state;
+
+  generate_srandom_r (seed, buf);
+
+  state[-1] = TYPE_0;
+  if (type != TYPE_0)
+    state[-1] = (buf->rptr - state) * MAX_TYPES + type;
+
+  return 0;
+
+ fail:
+  return -1;
+}
+
+/* Restore the state from the given state array.
+   Note: It is important that we also remember the locations of the pointers
+   in the current state information, and restore the locations of the pointers
+   from the old state information.  This is done by multiplexing the pointer
+   location into the zeroth word of the state information. Note that due
+   to the order in which things are done, it is OK to call setstate with the
+   same state as the current state
+   Returns a pointer to the old state information.  */
+int
+generate_setstate_r (char *arg_state, struct generate_random_data *buf)
+{
+  int *new_state = 1 + (int *) arg_state;
+  int type;
+  int old_type;
+  int *old_state;
+  int degree;
+  int separation;
+
+  if (arg_state == NULL || buf == NULL)
+    goto fail;
+
+  old_type = buf->rand_type;
+  old_state = buf->state;
+  if (old_type == TYPE_0)
+    old_state[-1] = TYPE_0;
+  else
+    old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+
+  type = new_state[-1] % MAX_TYPES;
+  if (type < TYPE_0 || type > TYPE_4)
+    goto fail;
+
+  buf->rand_deg = degree = random_poly_info.degrees[type];
+  buf->rand_sep = separation = random_poly_info.seps[type];
+  buf->rand_type = type;
+
+  if (type != TYPE_0)
+    {
+      int rear = new_state[-1] / MAX_TYPES;
+      buf->rptr = &new_state[rear];
+      buf->fptr = &new_state[(rear + separation) % degree];
+    }
+  buf->state = new_state;
+  /* Set end_ptr too.  */
+  buf->end_ptr = &new_state[degree];
+
+  return 0;
+
+ fail:
+  return -1;
+}
+
+/* If we are using the trivial TYPE_0 R.N.G., just do the old linear
+   congruential bit.  Otherwise, we do our fancy trinomial stuff, which is the
+   same in all the other cases due to all the global variables that have been
+   set up.  The basic operation is to add the number at the rear pointer into
+   the one at the front pointer.  Then both pointers are advanced to the next
+   location cyclically in the table.  The value returned is the sum generated,
+   reduced to 31 bits by throwing away the "least random" low bit.
+   Note: The code takes advantage of the fact that both the front and
+   rear pointers can't wrap on the same call by not testing the rear
+   pointer if the front one has wrapped.  Returns a 31-bit random number.  */
+
+int
+generate_random_r (struct generate_random_data *buf, int *result)
+{
+  int *state;
+
+  if (buf == NULL || result == NULL)
+    goto fail;
+
+  state = buf->state;
+
+  if (buf->rand_type == TYPE_0)
+    {
+      int val = state[0];
+      val = ((state[0] * 1103515245) + 12345) & 0x7fffffff;
+      state[0] = val;
+      *result = val;
+    }
+  else
+    {
+      int *fptr = buf->fptr;
+      int *rptr = buf->rptr;
+      int *end_ptr = buf->end_ptr;
+      int val;
+
+      val = *fptr += *rptr;
+      /* Chucking least random bit.  */
+      *result = (val >> 1) & 0x7fffffff;
+      ++fptr;
+      if (fptr >= end_ptr)
+	{
+	  fptr = state;
+	  ++rptr;
+	}
+      else
+	{
+	  ++rptr;
+	  if (rptr >= end_ptr)
+	    rptr = state;
+	}
+      buf->fptr = fptr;
+      buf->rptr = rptr;
+    }
+  return 0;
+
+ fail:
+  return -1;
+}
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_y1.h.jj	2004-07-22 14:58:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_y1.h	2004-07-21 16:28:22.000000000 +0200
@@ -0,0 +1,76 @@
+#include "struct-layout-1.h"
+
+#define F(n, x, v, w) 						\
+  if (info.flds[i] != &s##n.x)					\
+    FAIL (n, 50);						\
+  if (info.sizes[i] != sizeof (s##n.x))				\
+    FAIL (n, 51);						\
+  if (info.aligns[i] != __alignof__ (s##n.x))			\
+    FAIL (n, 52);						\
+  if (s##n.x != (__typeof__ (s##n.x)) v)			\
+    FAIL (n, 53);						\
+  if (a##n[2].x != (__typeof__ (s##n.x)) w)			\
+    FAIL (n, 54);						\
+  if (arg0.x != s##n.x)						\
+    FAIL (n, 55);						\
+  if (arg2.x != a##n[2].x)					\
+    FAIL (n, 56);						\
+  ret.x = s##n.x;						\
+  ++i;
+#define N(n, x) 						\
+  if (info.flds[i] != &s##n.x)					\
+    FAIL (n, 50);						\
+  if (info.sizes[i] != sizeof (s##n.x))				\
+    FAIL (n, 51);						\
+  if (info.aligns[i] != __alignof__ (s##n.x))			\
+    FAIL (n, 52);						\
+  ++i;
+#define B(n, x, v, w) 						\
+  b1.x = v; b2.x = w;						\
+  if (s##n.x != b1.x)						\
+    FAIL (n, 53);						\
+  if (a##n[2].x != b2.x)					\
+    FAIL (n, 54);						\
+  if (arg0.x != s##n.x)						\
+    FAIL (n, 55);						\
+  if (arg2.x != a##n[2].x)					\
+    FAIL (n, 56);						\
+  ret.x = s##n.x;						\
+  ++j;
+#define TX(n, type, attrs, fields, ops) 			\
+type S##n { fields } attrs;					\
+extern type S##n s##n;						\
+type S##n a##n[5];						\
+type S##n							\
+check##n (type S##n arg0, type S##n *arg1, type S##n arg2)	\
+{								\
+  type S##n ret;						\
+  type S##n b1, b2;						\
+  int i, j;							\
+								\
+  memset (&ret, 0, sizeof (ret));				\
+  memset (&b1, 0, sizeof (b1));					\
+  memset (&b2, 0, sizeof (b2));					\
+  if (info.sp != &s##n)						\
+    FAIL (n, 10);						\
+  if (info.a0p != &a##n[0])					\
+    FAIL (n, 11);						\
+  if (info.a3p != &a##n[3])					\
+    FAIL (n, 12);						\
+  if (info.sz != sizeof (s##n))					\
+    FAIL (n, 13);						\
+  if (info.als != __alignof__ (s##n))				\
+    FAIL (n, 14);						\
+  if (info.ala0 != __alignof__ (a##n[0]))			\
+    FAIL (n, 15);						\
+  if (info.ala3 != __alignof__ (a##n[3]))			\
+    FAIL (n, 16);						\
+  if (arg1 != &a##n[1])						\
+    FAIL (n, 17);						\
+  i = 0; j = 0;							\
+  ops								\
+  if (i != info.nfields || j != info.nbitfields)		\
+    FAIL (n, 18);						\
+								\
+  return ret;							\
+}
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_x2.h.jj	2004-07-22 14:58:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_x2.h	2004-07-13 18:53:18.000000000 +0200
@@ -0,0 +1,14 @@
+#undef F
+#undef N
+#undef B
+#undef TX
+#define F(n, x, v, w) 						\
+  if (arg.x != s##n.x) FAIL (n, 30);
+#define N(n, x)
+#define B(n, x, v, w)						\
+  if (arg.x != s##n.x) FAIL (n, 30);
+#define TX(n, type, attrs, fields, ops) 			\
+void checkx##n (type S##n arg)					\
+{								\
+  ops								\
+}
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_y2.h.jj	2004-07-22 14:58:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_y2.h	2004-07-13 13:39:51.000000000 +0200
@@ -0,0 +1,69 @@
+#undef F
+#undef N
+#undef B
+#undef TX
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define F(n, x, v, w) 						\
+  if (p->x != arg.x) FAIL (n, 74);
+#define N(n, x)
+#define B(n, x, v, w) 						\
+  if (p->x != arg.x) FAIL (n, 74);
+#define TX(n, type, attrs, fields, ops) 			\
+void								\
+check##n##va (int z, ...)					\
+{								\
+  type S##n arg, *p;						\
+  va_list ap;							\
+  int i;							\
+								\
+  if (test_va)							\
+    {								\
+      va_start (ap, z);						\
+      for (i = 0; i < 5; ++i)					\
+	{							\
+	  p = NULL;						\
+	  switch ((z << 4) | i)					\
+	    {							\
+	    case 0x10:						\
+	      if (va_arg (ap, double) != 1.0)			\
+		FAIL (n, 70);					\
+	      break;						\
+	    case 0x12:						\
+	      if (va_arg (ap, long long) != 2LL)		\
+		FAIL (n, 71);					\
+	      break;						\
+	    case 0x22:						\
+	      if (va_arg (ap, long double) != 2.0L)		\
+		FAIL (n, 72);					\
+	      break;						\
+	    case 0x11:						\
+	    case 0x20:						\
+	    case 0x21:						\
+	    case 0x24:						\
+	      p = &s##n;					\
+	      arg = va_arg (ap, type S##n);			\
+	      break;						\
+	    case 0x13:						\
+	    case 0x14:						\
+	    case 0x23:						\
+	      p = &a##n[2];					\
+	      arg = va_arg (ap, type S##n);			\
+	      break;						\
+	    default:						\
+	      FAIL (n, 73);					\
+	      break;						\
+	    }							\
+	  if (p)						\
+	    {							\
+	      ops						\
+	    }							\
+	}							\
+      va_end (ap);						\
+    }								\
+}
--- gcc/testsuite/gcc.dg/compat/generate-random.c.jj	2004-07-23 12:51:02.459002776 +0200
+++ gcc/testsuite/gcc.dg/compat/generate-random.c	2004-07-23 10:51:00.000000000 +0200
@@ -0,0 +1,271 @@
+/* Copyright (C) 1995, 2004 Free Software Foundation
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ * This is derived from the Berkeley source:
+ *	@(#)random.c	5.5 (Berkeley) 7/6/88
+ * It was reworked for the GNU C Library by Roland McGrath.
+ * Rewritten to use reentrant functions by Ulrich Drepper, 1995.
+ */
+
+/*
+   Copyright (C) 1983 Regents of the University of California.
+   All rights reserved.
+ 
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   4. Neither the name of the University nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+   SUCH DAMAGE.*/
+
+#include "config.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include "libiberty.h"
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include "generate-random.h"
+
+
+/* An improved random number generation package.  In addition to the standard
+   rand()/srand() like interface, this package also has a special state info
+   interface.  The initstate() routine is called with a seed, an array of
+   bytes, and a count of how many bytes are being passed in; this array is
+   then initialized to contain information for random number generation with
+   that much state information.  Good sizes for the amount of state
+   information are 32, 64, 128, and 256 bytes.  The state can be switched by
+   calling the setstate() function with the same array as was initialized
+   with initstate().  By default, the package runs with 128 bytes of state
+   information and generates far better random numbers than a linear
+   congruential generator.  If the amount of state information is less than
+   32 bytes, a simple linear congruential R.N.G. is used.  Internally, the
+   state information is treated as an array of longs; the zeroth element of
+   the array is the type of R.N.G. being used (small integer); the remainder
+   of the array is the state information for the R.N.G.  Thus, 32 bytes of
+   state information will give 7 longs worth of state information, which will
+   allow a degree seven polynomial.  (Note: The zeroth word of state
+   information also has some other information stored in it; see setstate
+   for details).  The random number generation technique is a linear feedback
+   shift register approach, employing trinomials (since there are fewer terms
+   to sum up that way).  In this approach, the least significant bit of all
+   the numbers in the state table will act as a linear feedback shift register,
+   and will have period 2^deg - 1 (where deg is the degree of the polynomial
+   being used, assuming that the polynomial is irreducible and primitive).
+   The higher order bits will have longer periods, since their values are
+   also influenced by pseudo-random carries out of the lower bits.  The
+   total period of the generator is approximately deg*(2**deg - 1); thus
+   doubling the amount of state information has a vast influence on the
+   period of the generator.  Note: The deg*(2**deg - 1) is an approximation
+   only good for large deg, when the period of the shift register is the
+   dominant factor.  With deg equal to seven, the period is actually much
+   longer than the 7*(2**7 - 1) predicted by this formula.  */
+
+
+
+/* For each of the currently supported random number generators, we have a
+   break value on the amount of state information (you need at least this many
+   bytes of state info to support this random number generator), a degree for
+   the polynomial (actually a trinomial) that the R.N.G. is based on, and
+   separation between the two lower order coefficients of the trinomial.  */
+
+/* Linear congruential.  */
+#define	TYPE_0		0
+#define	BREAK_0		8
+#define	DEG_0		0
+#define	SEP_0		0
+
+/* x**7 + x**3 + 1.  */
+#define	TYPE_1		1
+#define	BREAK_1		32
+#define	DEG_1		7
+#define	SEP_1		3
+
+/* x**15 + x + 1.  */
+#define	TYPE_2		2
+#define	BREAK_2		64
+#define	DEG_2		15
+#define	SEP_2		1
+
+/* x**31 + x**3 + 1.  */
+#define	TYPE_3		3
+#define	BREAK_3		128
+#define	DEG_3		31
+#define	SEP_3		3
+
+/* x**63 + x + 1.  */
+#define	TYPE_4		4
+#define	BREAK_4		256
+#define	DEG_4		63
+#define	SEP_4		1
+
+
+/* Array versions of the above information to make code run faster.
+   Relies on fact that TYPE_i == i.  */
+
+#define	MAX_TYPES	5	/* Max number of types above.  */
+
+
+/* Initially, everything is set up as if from:
+	initstate(1, randtbl, 128);
+   Note that this initialization takes advantage of the fact that srandom
+   advances the front and rear pointers 10*rand_deg times, and hence the
+   rear pointer which starts at 0 will also end up at zero; thus the zeroth
+   element of the state information, which contains info about the current
+   position of the rear pointer is just
+	(MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3.  */
+
+static int randtbl[DEG_3 + 1] =
+  {
+    TYPE_3,
+
+    -1726662223, 379960547, 1735697613, 1040273694, 1313901226,
+    1627687941, -179304937, -2073333483, 1780058412, -1989503057,
+    -615974602, 344556628, 939512070, -1249116260, 1507946756,
+    -812545463, 154635395, 1388815473, -1926676823, 525320961,
+    -1009028674, 968117788, -123449607, 1284210865, 435012392,
+    -2017506339, -911064859, -370259173, 1132637927, 1398500161,
+    -205601318,
+  };
+
+
+static struct generate_random_data unsafe_state =
+  {
+/* FPTR and RPTR are two pointers into the state info, a front and a rear
+   pointer.  These two pointers are always rand_sep places aparts, as they
+   cycle through the state information.  (Yes, this does mean we could get
+   away with just one pointer, but the code for random is more efficient
+   this way).  The pointers are left positioned as they would be from the call:
+	initstate(1, randtbl, 128);
+   (The position of the rear pointer, rptr, is really 0 (as explained above
+   in the initialization of randtbl) because the state table pointer is set
+   to point to randtbl[1] (as explained below).)  */
+
+    .fptr = &randtbl[SEP_3 + 1],
+    .rptr = &randtbl[1],
+
+/* The following things are the pointer to the state information table,
+   the type of the current generator, the degree of the current polynomial
+   being used, and the separation between the two pointers.
+   Note that for efficiency of random, we remember the first location of
+   the state information, not the zeroth.  Hence it is valid to access
+   state[-1], which is used to store the type of the R.N.G.
+   Also, we remember the last location, since this is more efficient than
+   indexing every time to find the address of the last element to see if
+   the front and rear pointers have wrapped.  */
+
+    .state = &randtbl[1],
+
+    .rand_type = TYPE_3,
+    .rand_deg = DEG_3,
+    .rand_sep = SEP_3,
+
+    .end_ptr = &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
+};
+
+/* Initialize the random number generator based on the given seed.  If the
+   type is the trivial no-state-information type, just remember the seed.
+   Otherwise, initializes state[] based on the given "seed" via a linear
+   congruential generator.  Then, the pointers are set to known locations
+   that are exactly rand_sep places apart.  Lastly, it cycles the state
+   information a given number of times to get rid of any initial dependencies
+   introduced by the L.C.R.N.G.  Note that the initialization of randtbl[]
+   for default usage relies on values produced by this routine.  */
+void
+generate_srandom (unsigned int x)
+{
+  (void) generate_srandom_r (x, &unsafe_state);
+}
+
+/* Initialize the state information in the given array of N bytes for
+   future random number generation.  Based on the number of bytes we
+   are given, and the break values for the different R.N.G.'s, we choose
+   the best (largest) one we can and set things up for it.  srandom is
+   then called to initialize the state information.  Note that on return
+   from srandom, we set state[-1] to be the type multiplexed with the current
+   value of the rear pointer; this is so successive calls to initstate won't
+   lose this information and will be able to restart with setstate.
+   Note: The first thing we do is save the current state, if any, just like
+   setstate so that it doesn't matter when initstate is called.
+   Returns a pointer to the old state.  */
+char *
+generate_initstate (unsigned int seed, char *arg_state, size_t n)
+{
+  int *ostate;
+
+  ostate = &unsafe_state.state[-1];
+  generate_initstate_r (seed, arg_state, n, &unsafe_state);
+  return (char *) ostate;
+}
+
+/* Restore the state from the given state array.
+   Note: It is important that we also remember the locations of the pointers
+   in the current state information, and restore the locations of the pointers
+   from the old state information.  This is done by multiplexing the pointer
+   location into the zeroth word of the state information. Note that due
+   to the order in which things are done, it is OK to call setstate with the
+   same state as the current state
+   Returns a pointer to the old state information.  */
+char *
+generate_setstate (char *arg_state)
+{
+  int *ostate;
+
+  ostate = &unsafe_state.state[-1];
+  if (generate_setstate_r (arg_state, &unsafe_state) < 0)
+    ostate = NULL;
+  return (char *) ostate;
+}
+
+/* If we are using the trivial TYPE_0 R.N.G., just do the old linear
+   congruential bit.  Otherwise, we do our fancy trinomial stuff, which is the
+   same in all the other cases due to all the global variables that have been
+   set up.  The basic operation is to add the number at the rear pointer into
+   the one at the front pointer.  Then both pointers are advanced to the next
+   location cyclically in the table.  The value returned is the sum generated,
+   reduced to 31 bits by throwing away the "least random" low bit.
+   Note: The code takes advantage of the fact that both the front and
+   rear pointers can't wrap on the same call by not testing the rear
+   pointer if the front one has wrapped.  Returns a 31-bit random number.  */
+
+long int
+generate_random (void)
+{
+  int retval;
+  (void) generate_random_r (&unsafe_state, &retval);
+  return retval;
+}
--- gcc/testsuite/lib/compat.exp.jj	2004-06-09 00:01:49.000000000 +0200
+++ gcc/testsuite/lib/compat.exp	2004-07-23 14:47:38.583048018 +0200
@@ -277,6 +277,7 @@ proc compat-execute { src1 sid use_alt }
 
     # Get the base name of this test, for use in messages.
     regsub "^$srcdir/?" $src1 "" testcase
+    regsub "^$tmpdir/?" $testcase "tmpdir-" testcase
     regsub "_main.*" $testcase "" testcase
     # Set up the base name of executable files so they'll be unique.
     regsub -all "\[./\]" $testcase "-" execbase
--- gcc/testsuite/README.compat.jj	2003-04-23 21:56:42.000000000 +0200
+++ gcc/testsuite/README.compat	2004-07-22 16:12:04.000000000 +0200
@@ -29,6 +29,11 @@ sets of compiler options.
   varible ALT_LD_LIBRARY_PATH.  If it needs different options to build
   a shared object, define those in ALT_SHOBJ_OPTIONS.
 
+  Normally, only a small amount of compatibility tests is run.
+  Setting RUN_ALL_COMPAT_TESTS=1 in the environment before running the
+  testsuite enables running all compatibility tests, but might take
+  significantly longer than it takes without this variable.
+
 To run only the C++ compatibility tests, optionally specifying an
 alternate compiler and/or sets of options, do from $objdir/gcc:
 

	Jakub


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