From 49fc196e8edd206d1cd275cd015238e429056db7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 25 Apr 2005 00:01:53 +0200 Subject: [PATCH] struct-layout-1_generate.c: In arrays avoid types where sizeof (type) < __alignof__ (type). * gcc.dg/compat/struct-layout-1_generate.c: In arrays avoid types where sizeof (type) < __alignof__ (type). * gcc.dg/compat/struct-layout-1.h: Likewise. From-SVN: r98673 --- gcc/testsuite/ChangeLog | 6 + gcc/testsuite/gcc.dg/compat/struct-layout-1.h | 205 ++++++++++++++++++ .../gcc.dg/compat/struct-layout-1_generate.c | 186 +++++++++++++++- 3 files changed, 388 insertions(+), 9 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index beaa8514f9e..79373868287 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-04-24 Jakub Jelinek + + * gcc.dg/compat/struct-layout-1_generate.c: In arrays avoid types + where sizeof (type) < __alignof__ (type). + * gcc.dg/compat/struct-layout-1.h: Likewise. + 2005-04-24 Per Bothner Devang Patel diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1.h b/gcc/testsuite/gcc.dg/compat/struct-layout-1.h index e50d4fb5833..e165e203a32 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1.h +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1.h @@ -101,6 +101,64 @@ extern int fn5 (void), fn6 (void), fn7 (void), fn8 (void), fn9 (void); #define atpaal8 __attribute__((packed, aligned (8))) #define atpaal16 __attribute__((packed, aligned (16))) +#if UCHAR_MAX == 255 && USHORT_MAX == 65535 && UINT_MAX == 4294967295U \ + && ULLONG_MAX == 18446744073709551615ULL +/* For ILP32 and LP64 targets, assume float is at least 32-bit + and double plus long double at least 64-bit. */ +# define atalx1 atal1 +# define atalx2 atal2 +# define atalx4 atal4 +# define atalx8 atal8 +# define atalx16 atal16 +# define atalx1pa atal1pa +# define atalx2pa atal2pa +# define atalx4pa atal4pa +# define atalx8pa atal8pa +# define atalx16pa atal16pa +# define atpaalx1 atpaal1 +# define atpaalx2 atpaal2 +# define atpaalx4 atpaal4 +# define atpaalx8 atpaal8 +# define atpaalx16 atpaal16 +# if ULONG_MAX > 4294967295UL +# define ataly8 atal8 +# define ataly8pa atal8pa +# define atpaaly8 atpaal8 +# define ataly16 atal16 +# define ataly16pa atal16pa +# define atpaaly16 atpaal16 +# else +# define ataly8 +# define ataly8pa +# define atpaaly8 +# define ataly16 +# define ataly16pa +# define atpaaly16 +# endif +#else +# define atalx1 +# define atalx2 +# define atalx4 +# define atalx8 +# define atalx16 +# define atalx1pa +# define atalx2pa +# define atalx4pa +# define atalx8pa +# define atalx16pa +# define atpaalx1 +# define atpaalx2 +# define atpaalx4 +# define atpaalx8 +# define atpaalx16 +# define ataly8 +# define ataly8pa +# define atpaaly8 +# define ataly16 +# define ataly16pa +# define atpaaly16 +#endif + #define atQI __attribute__((mode (QI))) #define atHI __attribute__((mode (HI))) #define atSI __attribute__((mode (SI))) @@ -427,6 +485,153 @@ typedef enum E9 Tal16E9 atal16; typedef void *Tal16ptr atal16; typedef char *Tal16cptr atal16; typedef int *Tal16iptr atal16; +typedef char Talx1char atalx1; +typedef signed char Talx1schar atalx1; +typedef unsigned char Talx1uchar atalx1; +typedef short int Talx1short atalx1; +typedef unsigned short int Talx1ushort atalx1; +typedef int Talx1int atalx1; +typedef unsigned int Talx1uint atalx1; +typedef long int Talx1long atalx1; +typedef unsigned long int Talx1ulong atalx1; +typedef long long int Talx1llong atalx1; +typedef unsigned long long int Talx1ullong atalx1; +#ifndef SKIP_COMPLEX_INT +typedef _Complex char Talx1cchar atalx1; +typedef _Complex signed char Talx1cschar atalx1; +typedef _Complex unsigned char Talx1cuchar atalx1; +typedef _Complex short int Talx1cshort atalx1; +typedef _Complex unsigned short int Talx1cushort atalx1; +typedef _Complex int Talx1cint atalx1; +typedef _Complex unsigned int Talx1cuint atalx1; +typedef _Complex long int Talx1clong atalx1; +typedef _Complex unsigned long int Talx1culong atalx1; +typedef _Complex long long int Talx1cllong atalx1; +typedef _Complex unsigned long long int Talx1cullong atalx1; +#endif +typedef float Talx1float atalx1; +typedef double Talx1double atalx1; +typedef long double Talx1ldouble atalx1; +typedef _Complex float Talx1cfloat atalx1; +typedef _Complex double Talx1cdouble atalx1; +typedef _Complex long double Talx1cldouble atalx1; +typedef bool Talx1bool atalx1; +typedef enum E0 Talx1E0 atalx1; +typedef enum E1 Talx1E1 atalx1; +typedef enum E2 Talx1E2 atalx1; +typedef enum E3 Talx1E3 atalx1; +typedef enum E4 Talx1E4 atalx1; +typedef enum E5 Talx1E5 atalx1; +typedef enum E6 Talx1E6 atalx1; +typedef enum E7 Talx1E7 atalx1; +typedef enum E8 Talx1E8 atalx1; +typedef enum E9 Talx1E9 atalx1; +typedef void *Talx1ptr atalx1; +typedef char *Talx1cptr atalx1; +typedef int *Talx1iptr atalx1; +typedef short int Talx2short atalx2; +typedef unsigned short int Talx2ushort atalx2; +typedef int Talx2int atalx2; +typedef unsigned int Talx2uint atalx2; +typedef long int Talx2long atalx2; +typedef unsigned long int Talx2ulong atalx2; +typedef long long int Talx2llong atalx2; +typedef unsigned long long int Talx2ullong atalx2; +#ifndef SKIP_COMPLEX_INT +typedef _Complex char Talx2cchar atalx2; +typedef _Complex signed char Talx2cschar atalx2; +typedef _Complex unsigned char Talx2cuchar atalx2; +typedef _Complex short int Talx2cshort atalx2; +typedef _Complex unsigned short int Talx2cushort atalx2; +typedef _Complex int Talx2cint atalx2; +typedef _Complex unsigned int Talx2cuint atalx2; +typedef _Complex long int Talx2clong atalx2; +typedef _Complex unsigned long int Talx2culong atalx2; +typedef _Complex long long int Talx2cllong atalx2; +typedef _Complex unsigned long long int Talx2cullong atalx2; +#endif +typedef float Talx2float atalx2; +typedef double Talx2double atalx2; +typedef long double Talx2ldouble atalx2; +typedef _Complex float Talx2cfloat atalx2; +typedef _Complex double Talx2cdouble atalx2; +typedef _Complex long double Talx2cldouble atalx2; +typedef enum E0 Talx2E0 atalx2; +typedef enum E1 Talx2E1 atalx2; +typedef enum E2 Talx2E2 atalx2; +typedef enum E3 Talx2E3 atalx2; +typedef enum E4 Talx2E4 atalx2; +typedef enum E5 Talx2E5 atalx2; +typedef enum E6 Talx2E6 atalx2; +typedef enum E7 Talx2E7 atalx2; +typedef enum E8 Talx2E8 atalx2; +typedef enum E9 Talx2E9 atalx2; +typedef void *Talx2ptr atalx2; +typedef char *Talx2cptr atalx2; +typedef int *Talx2iptr atalx2; +typedef int Talx4int atalx4; +typedef unsigned int Talx4uint atalx4; +typedef long int Talx4long atalx4; +typedef unsigned long int Talx4ulong atalx4; +typedef long long int Talx4llong atalx4; +typedef unsigned long long int Talx4ullong atalx4; +#ifndef SKIP_COMPLEX_INT +typedef _Complex short int Talx4cshort atalx4; +typedef _Complex unsigned short int Talx4cushort atalx4; +typedef _Complex int Talx4cint atalx4; +typedef _Complex unsigned int Talx4cuint atalx4; +typedef _Complex long int Talx4clong atalx4; +typedef _Complex unsigned long int Talx4culong atalx4; +typedef _Complex long long int Talx4cllong atalx4; +typedef _Complex unsigned long long int Talx4cullong atalx4; +#endif +typedef float Talx4float atalx4; +typedef double Talx4double atalx4; +typedef long double Talx4ldouble atalx4; +typedef _Complex float Talx4cfloat atalx4; +typedef _Complex double Talx4cdouble atalx4; +typedef _Complex long double Talx4cldouble atalx4; +typedef enum E0 Talx4E0 atalx4; +typedef enum E1 Talx4E1 atalx4; +typedef enum E2 Talx4E2 atalx4; +typedef enum E3 Talx4E3 atalx4; +typedef enum E4 Talx4E4 atalx4; +typedef enum E5 Talx4E5 atalx4; +typedef enum E6 Talx4E6 atalx4; +typedef enum E7 Talx4E7 atalx4; +typedef enum E8 Talx4E8 atalx4; +typedef enum E9 Talx4E9 atalx4; +typedef void *Talx4ptr atalx4; +typedef char *Talx4cptr atalx4; +typedef int *Talx4iptr atalx4; +typedef long int Taly8long ataly8; +typedef unsigned long int Taly8ulong ataly8; +typedef long long int Talx8llong atalx8; +typedef unsigned long long int Talx8ullong atalx8; +#ifndef SKIP_COMPLEX_INT +typedef _Complex int Talx8cint atalx8; +typedef _Complex unsigned int Talx8cuint atalx8; +typedef _Complex long int Talx8clong atalx8; +typedef _Complex unsigned long int Talx8culong atalx8; +typedef _Complex long long int Talx8cllong atalx8; +typedef _Complex unsigned long long int Talx8cullong atalx8; +#endif +typedef double Talx8double atalx8; +typedef long double Talx8ldouble atalx8; +typedef _Complex float Talx8cfloat atalx8; +typedef _Complex double Talx8cdouble atalx8; +typedef _Complex long double Talx8cldouble atalx8; +typedef void *Taly8ptr ataly8; +typedef char *Taly8cptr ataly8; +typedef int *Taly8iptr ataly8; +#ifndef SKIP_COMPLEX_INT +typedef _Complex long int Taly16clong ataly16; +typedef _Complex unsigned long int Taly16culong ataly16; +typedef _Complex long long int Talx16cllong atalx16; +typedef _Complex unsigned long long int Talx16cullong atalx16; +#endif +typedef _Complex double Talx16cdouble atalx16; +typedef _Complex long double Talx16cldouble atalx16; typedef int (*Tfnptr) (void); /* Bitfield macros. In C, it is invalid to use numbers larger diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c index dab24966db6..192d7c2ef9b 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c @@ -1,5 +1,5 @@ /* Structure layout test generator. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. Contributed by Jakub Jelinek . This file is part of GCC. @@ -459,6 +459,149 @@ struct types complex_attrib_types[] = { { "Tal16cldouble", TYPE_CFLOAT, 0, 0 } #define NCATYPES2 (sizeof (complex_attrib_types) / sizeof (complex_attrib_types[0])) }; +struct types attrib_array_types[] = { +{ "Talx1char", TYPE_UINT, 127, 'C' }, +{ "Talx1schar", TYPE_INT, 127, 'C' }, +{ "Talx1uchar", TYPE_UINT, 255, 'C' }, +{ "Talx1short", TYPE_INT, 32767, 'S' }, +{ "Talx1ushort", TYPE_UINT, 65535, 'S' }, +{ "Talx1int", TYPE_INT, 2147483647, 'I' }, +{ "Talx1uint", TYPE_UINT, 4294967295U, 'I' }, +{ "Talx1long", TYPE_INT, 9223372036854775807LL, 'L' }, +{ "Talx1ulong", TYPE_UINT, 18446744073709551615ULL, 'L' }, +{ "Talx1llong", TYPE_INT, 9223372036854775807LL, 'Q' }, +{ "Talx1ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' }, +{ "Talx1bool", TYPE_UINT, 1, 'B' }, +{ "Talx1ptr", TYPE_PTR, 0, 0 }, +{ "Talx1cptr", TYPE_PTR, 0, 0 }, +{ "Talx1iptr", TYPE_PTR, 0, 0 }, +{ "Talx1float", TYPE_FLOAT, 0, 0 }, +{ "Talx1double", TYPE_FLOAT, 0, 0 }, +{ "Talx1ldouble", TYPE_FLOAT, 0, 0 }, +{ "Talx1E0", TYPE_UENUM, 0, ' ' }, +{ "Talx1E1", TYPE_UENUM, 1, ' ' }, +{ "Talx1E2", TYPE_SENUM, 3, ' ' }, +{ "Talx1E3", TYPE_SENUM, 127, ' ' }, +{ "Talx1E4", TYPE_UENUM, 255, ' ' }, +{ "Talx1E5", TYPE_SENUM, 32767, ' ' }, +{ "Talx1E6", TYPE_UENUM, 65535, ' ' }, +{ "Talx1E7", TYPE_SENUM, 2147483647, ' ' }, +{ "Talx1E8", TYPE_UENUM, 4294967295U, ' ' }, +{ "Talx1E9", TYPE_SENUM, 1099511627775LL, ' ' }, +{ "Talx2short", TYPE_INT, 32767, 'S' }, +{ "Talx2ushort", TYPE_UINT, 65535, 'S' }, +{ "Talx2int", TYPE_INT, 2147483647, 'I' }, +{ "Talx2uint", TYPE_UINT, 4294967295U, 'I' }, +{ "Talx2long", TYPE_INT, 9223372036854775807LL, 'L' }, +{ "Talx2ulong", TYPE_UINT, 18446744073709551615ULL, 'L' }, +{ "Talx2llong", TYPE_INT, 9223372036854775807LL, 'Q' }, +{ "Talx2ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' }, +{ "Talx2ptr", TYPE_PTR, 0, 0 }, +{ "Talx2cptr", TYPE_PTR, 0, 0 }, +{ "Talx2iptr", TYPE_PTR, 0, 0 }, +{ "Talx2float", TYPE_FLOAT, 0, 0 }, +{ "Talx2double", TYPE_FLOAT, 0, 0 }, +{ "Talx2ldouble", TYPE_FLOAT, 0, 0 }, +{ "Talx2E0", TYPE_UENUM, 0, ' ' }, +{ "Talx2E1", TYPE_UENUM, 1, ' ' }, +{ "Talx2E2", TYPE_SENUM, 3, ' ' }, +{ "Talx2E3", TYPE_SENUM, 127, ' ' }, +{ "Talx2E4", TYPE_UENUM, 255, ' ' }, +{ "Talx2E5", TYPE_SENUM, 32767, ' ' }, +{ "Talx2E6", TYPE_UENUM, 65535, ' ' }, +{ "Talx2E7", TYPE_SENUM, 2147483647, ' ' }, +{ "Talx2E8", TYPE_UENUM, 4294967295U, ' ' }, +{ "Talx2E9", TYPE_SENUM, 1099511627775LL, ' ' }, +{ "Talx4int", TYPE_INT, 2147483647, 'I' }, +{ "Talx4uint", TYPE_UINT, 4294967295U, 'I' }, +{ "Talx4long", TYPE_INT, 9223372036854775807LL, 'L' }, +{ "Talx4ulong", TYPE_UINT, 18446744073709551615ULL, 'L' }, +{ "Talx4llong", TYPE_INT, 9223372036854775807LL, 'Q' }, +{ "Talx4ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' }, +{ "Talx4ptr", TYPE_PTR, 0, 0 }, +{ "Talx4cptr", TYPE_PTR, 0, 0 }, +{ "Talx4iptr", TYPE_PTR, 0, 0 }, +{ "Talx4float", TYPE_FLOAT, 0, 0 }, +{ "Talx4double", TYPE_FLOAT, 0, 0 }, +{ "Talx4ldouble", TYPE_FLOAT, 0, 0 }, +{ "Talx4E0", TYPE_UENUM, 0, ' ' }, +{ "Talx4E1", TYPE_UENUM, 1, ' ' }, +{ "Talx4E2", TYPE_SENUM, 3, ' ' }, +{ "Talx4E3", TYPE_SENUM, 127, ' ' }, +{ "Talx4E4", TYPE_UENUM, 255, ' ' }, +{ "Talx4E5", TYPE_SENUM, 32767, ' ' }, +{ "Talx4E6", TYPE_UENUM, 65535, ' ' }, +{ "Talx4E7", TYPE_SENUM, 2147483647, ' ' }, +{ "Talx4E8", TYPE_UENUM, 4294967295U, ' ' }, +{ "Talx4E9", TYPE_SENUM, 1099511627775LL, ' ' }, +{ "Taly8long", TYPE_INT, 9223372036854775807LL, 'L' }, +{ "Taly8ulong", TYPE_UINT, 18446744073709551615ULL, 'L' }, +{ "Talx8llong", TYPE_INT, 9223372036854775807LL, 'Q' }, +{ "Talx8ullong", TYPE_UINT, 18446744073709551615ULL, 'Q' }, +{ "Taly8ptr", TYPE_PTR, 0, 0 }, +{ "Taly8cptr", TYPE_PTR, 0, 0 }, +{ "Taly8iptr", TYPE_PTR, 0, 0 }, +{ "Talx8double", TYPE_FLOAT, 0, 0 }, +{ "Talx8ldouble", TYPE_FLOAT, 0, 0 } +#define NAATYPES2 (sizeof (attrib_array_types) / sizeof (attrib_array_types[0])) +}; +struct types complex_attrib_array_types[] = { +{ "Talx1cchar", TYPE_CUINT, 127, 0 }, +{ "Talx1cschar", TYPE_CINT, 127, 0 }, +{ "Talx1cuchar", TYPE_CUINT, 255, 0 }, +{ "Talx1cshort", TYPE_CINT, 32767, 0 }, +{ "Talx1cushort", TYPE_CUINT, 65535, 0 }, +{ "Talx1cint", TYPE_CINT, 2147483647, 0 }, +{ "Talx1cuint", TYPE_CUINT, 4294967295U, 0 }, +{ "Talx1clong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx1culong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx1cllong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx1cullong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx1cfloat", TYPE_CFLOAT, 0, 0 }, +{ "Talx1cdouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx1cldouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx2cchar", TYPE_CUINT, 127, 0 }, +{ "Talx2cschar", TYPE_CINT, 127, 0 }, +{ "Talx2cuchar", TYPE_CUINT, 255, 0 }, +{ "Talx2cshort", TYPE_CINT, 32767, 0 }, +{ "Talx2cushort", TYPE_CUINT, 65535, 0 }, +{ "Talx2cint", TYPE_CINT, 2147483647, 0 }, +{ "Talx2cuint", TYPE_CUINT, 4294967295U, 0 }, +{ "Talx2clong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx2culong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx2cllong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx2cullong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx2cfloat", TYPE_CFLOAT, 0, 0 }, +{ "Talx2cdouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx2cldouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx4cshort", TYPE_CINT, 32767, 0 }, +{ "Talx4cushort", TYPE_CUINT, 65535, 0 }, +{ "Talx4cint", TYPE_CINT, 2147483647, 0 }, +{ "Talx4cuint", TYPE_CUINT, 4294967295U, 0 }, +{ "Talx4clong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx4culong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx4cllong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx4cullong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx4cfloat", TYPE_CFLOAT, 0, 0 }, +{ "Talx4cdouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx4cldouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx8cint", TYPE_CINT, 2147483647, 0 }, +{ "Talx8cuint", TYPE_CUINT, 4294967295U, 0 }, +{ "Talx8clong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx8culong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx8cllong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx8cullong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx8cfloat", TYPE_CFLOAT, 0, 0 }, +{ "Talx8cdouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx8cldouble", TYPE_CFLOAT, 0, 0 }, +{ "Taly16clong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Taly16culong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx16cllong", TYPE_CINT, 9223372036854775807LL, 0 }, +{ "Talx16cullong", TYPE_CUINT, 18446744073709551615ULL, 0 }, +{ "Talx16cdouble", TYPE_CFLOAT, 0, 0 }, +{ "Talx16cldouble", TYPE_CFLOAT, 0, 0 } +#define NCAATYPES2 (sizeof (complex_attrib_array_types) / sizeof (complex_attrib_array_types[0])) +}; struct types bitfld_types[NTYPES2]; int n_bitfld_types; @@ -1153,7 +1296,7 @@ singles (enum FEATURE features) } void -choose_type (enum FEATURE features, struct entry *e, int r) +choose_type (enum FEATURE features, struct entry *e, int r, int in_array) { int i; @@ -1164,9 +1307,18 @@ choose_type (enum FEATURE features, struct entry *e, int r) i += NVTYPES2; if ((r & 3) == 0) { - i += NATYPES2; - if (features & FEATURE_COMPLEX) - i += NCATYPES2; + if (in_array) + { + i += NAATYPES2; + if (features & FEATURE_COMPLEX) + i += NCAATYPES2; + } + else + { + i += NATYPES2; + if (features & FEATURE_COMPLEX) + i += NCATYPES2; + } } r >>= 2; r %= i; @@ -1185,18 +1337,30 @@ choose_type (enum FEATURE features, struct entry *e, int r) e->type = &vector_types[r]; r -= NVTYPES2; } - if (e->type == NULL) + if (e->type == NULL && !in_array) { if (r < NATYPES2) e->type = &attrib_types[r]; r -= NATYPES2; } - if (e->type == NULL && (features & FEATURE_COMPLEX)) + if (e->type == NULL && !in_array && (features & FEATURE_COMPLEX)) { if (r < NCATYPES2) e->type = &complex_attrib_types[r]; r -= NCATYPES2; } + if (e->type == NULL && in_array) + { + if (r < NAATYPES2) + e->type = &attrib_array_types[r]; + r -= NAATYPES2; + } + if (e->type == NULL && in_array && (features & FEATURE_COMPLEX)) + { + if (r < NCAATYPES2) + e->type = &complex_attrib_array_types[r]; + r -= NCAATYPES2; + } if (e->type == NULL) abort (); } @@ -1243,7 +1407,7 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent, break; case 4: e[n].etype = ETYPE_TYPE; - choose_type (features, &e[n], r); + choose_type (features, &e[n], r, 0); break; case 5: e[n].etype = ETYPE_ARRAY; @@ -1252,7 +1416,7 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent, if (i) e[n].type = &base_types[r % NTYPES1]; else - choose_type (features, &e[n], r); + choose_type (features, &e[n], r, 1); r = generate_random (); if ((features & FEATURE_ZEROARRAY) && (r & 3) == 0) { @@ -1425,6 +1589,10 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent, && e[n].type < &attrib_types[NATYPES2]) || (e[n].type >= &complex_attrib_types[0] && e[n].type < &complex_attrib_types[NCATYPES2]) + || (e[n].type >= &attrib_array_types[0] + && e[n].type < &attrib_array_types[NAATYPES2]) + || (e[n].type >= &complex_attrib_array_types[0] + && e[n].type < &complex_attrib_array_types[NAATYPES2]) || (e[n].type >= &aligned_bitfld_types[0] && e[n].type < &aligned_bitfld_types[n_aligned_bitfld_types]))) e[n].attrib = NULL; -- 2.30.2