(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
compat/
struct-by-value-2_y.c
       1  #include <stdarg.h>
       2  
       3  #include "compat-common.h"
       4  
       5  #ifdef SKIP_VA
       6  const int test_va = 0;
       7  #else
       8  const int test_va = 1;
       9  #endif
      10  
      11  #define T(N, NAME, TYPE)					\
      12  struct S##NAME##N { TYPE i[N]; };				\
      13  								\
      14  extern struct S##NAME##N g1s##NAME##N, g2s##NAME##N;		\
      15  extern struct S##NAME##N g3s##NAME##N, g4s##NAME##N;		\
      16  extern struct S##NAME##N g5s##NAME##N, g6s##NAME##N;		\
      17  extern struct S##NAME##N g7s##NAME##N, g8s##NAME##N;		\
      18  extern struct S##NAME##N g9s##NAME##N, g10s##NAME##N;		\
      19  extern struct S##NAME##N g11s##NAME##N, g12s##NAME##N;		\
      20  extern struct S##NAME##N g13s##NAME##N, g14s##NAME##N;		\
      21  extern struct S##NAME##N g15s##NAME##N, g16s##NAME##N;		\
      22  								\
      23  extern void check##NAME##N (struct S##NAME##N *p, int i);	\
      24  extern void							\
      25  test2_##NAME##N (struct S##NAME##N s1, struct S##NAME##N s2,	\
      26  		 struct S##NAME##N s3, struct S##NAME##N s4,	\
      27  		 struct S##NAME##N s5, struct S##NAME##N s6,	\
      28  		 struct S##NAME##N s7, struct S##NAME##N s8);	\
      29  								\
      30  void								\
      31  init##NAME##N (struct S##NAME##N *p, int i)			\
      32  {								\
      33    int j;							\
      34    for (j = 0; j < N; j++)					\
      35      p->i[j] = i + j;						\
      36  }								\
      37  								\
      38  void								\
      39  checkg##NAME##N (void)						\
      40  {								\
      41    check##NAME##N ( &g1s##NAME##N,  1*16);			\
      42    check##NAME##N ( &g2s##NAME##N,  2*16);			\
      43    check##NAME##N ( &g3s##NAME##N,  3*16);			\
      44    check##NAME##N ( &g4s##NAME##N,  4*16);			\
      45    check##NAME##N ( &g5s##NAME##N,  5*16);			\
      46    check##NAME##N ( &g6s##NAME##N,  6*16);			\
      47    check##NAME##N ( &g7s##NAME##N,  7*16);			\
      48    check##NAME##N ( &g8s##NAME##N,  8*16);			\
      49    check##NAME##N ( &g9s##NAME##N,  9*16);			\
      50    check##NAME##N (&g10s##NAME##N, 10*16);			\
      51    check##NAME##N (&g11s##NAME##N, 11*16);			\
      52    check##NAME##N (&g12s##NAME##N, 12*16);			\
      53    check##NAME##N (&g13s##NAME##N, 13*16);			\
      54    check##NAME##N (&g14s##NAME##N, 14*16);			\
      55    check##NAME##N (&g15s##NAME##N, 15*16);			\
      56    check##NAME##N (&g16s##NAME##N, 16*16);			\
      57  }								\
      58  								\
      59  void								\
      60  test##NAME##N (struct S##NAME##N s1, struct S##NAME##N s2,	\
      61  	       struct S##NAME##N s3, struct S##NAME##N s4,	\
      62  	       struct S##NAME##N s5, struct S##NAME##N s6,	\
      63  	       struct S##NAME##N s7, struct S##NAME##N s8,	\
      64  	       struct S##NAME##N s9, struct S##NAME##N s10,	\
      65  	       struct S##NAME##N s11, struct S##NAME##N s12,	\
      66  	       struct S##NAME##N s13, struct S##NAME##N s14,	\
      67  	       struct S##NAME##N s15, struct S##NAME##N s16)	\
      68  {								\
      69    check##NAME##N (&s1, 1*16);					\
      70    check##NAME##N (&s2, 2*16);					\
      71    check##NAME##N (&s3, 3*16);					\
      72    check##NAME##N (&s4, 4*16);					\
      73    check##NAME##N (&s5, 5*16);					\
      74    check##NAME##N (&s6, 6*16);					\
      75    check##NAME##N (&s7, 7*16);					\
      76    check##NAME##N (&s8, 8*16);					\
      77    check##NAME##N (&s9, 9*16);					\
      78    check##NAME##N (&s10, 10*16);					\
      79    check##NAME##N (&s11, 11*16);					\
      80    check##NAME##N (&s12, 12*16);					\
      81    check##NAME##N (&s13, 13*16);					\
      82    check##NAME##N (&s14, 14*16);					\
      83    check##NAME##N (&s15, 15*16);					\
      84    check##NAME##N (&s16, 16*16);					\
      85  }								\
      86  								\
      87  void								\
      88  testva##NAME##N (int n, ...)					\
      89  {								\
      90    int i;							\
      91    va_list ap;							\
      92    if (test_va)							\
      93      {								\
      94        va_start (ap, n);						\
      95        for (i = 0; i < n; i++)					\
      96  	{							\
      97  	  struct S##NAME##N t = va_arg (ap, struct S##NAME##N);	\
      98  	  check##NAME##N (&t, (i+1)*16);			\
      99  	}							\
     100        va_end (ap);						\
     101      }								\
     102  }
     103  
     104  #ifndef SKIP_ZERO_ARRAY
     105  T(0, uc, unsigned char)
     106  #endif
     107  T(1, uc, unsigned char)
     108  T(2, uc, unsigned char)
     109  T(3, uc, unsigned char)
     110  T(4, uc, unsigned char)
     111  T(5, uc, unsigned char)
     112  T(6, uc, unsigned char)
     113  T(7, uc, unsigned char)
     114  T(8, uc, unsigned char)
     115  T(9, uc, unsigned char)
     116  T(10, uc, unsigned char)
     117  T(11, uc, unsigned char)
     118  T(12, uc, unsigned char)
     119  T(13, uc, unsigned char)
     120  T(14, uc, unsigned char)
     121  T(15, uc, unsigned char)
     122  #ifndef SKIP_ZERO_ARRAY
     123  T(0, us, unsigned short)
     124  #endif
     125  T(1, us, unsigned short)
     126  T(2, us, unsigned short)
     127  T(3, us, unsigned short)
     128  T(4, us, unsigned short)
     129  T(5, us, unsigned short)
     130  T(6, us, unsigned short)
     131  T(7, us, unsigned short)
     132  T(8, us, unsigned short)
     133  T(9, us, unsigned short)
     134  T(10, us, unsigned short)
     135  T(11, us, unsigned short)
     136  T(12, us, unsigned short)
     137  T(13, us, unsigned short)
     138  T(14, us, unsigned short)
     139  T(15, us, unsigned short)
     140  #ifndef SKIP_ZERO_ARRAY
     141  T(0, ui, unsigned int)
     142  #endif
     143  T(1, ui, unsigned int)
     144  T(2, ui, unsigned int)
     145  T(3, ui, unsigned int)
     146  T(4, ui, unsigned int)
     147  T(5, ui, unsigned int)
     148  T(6, ui, unsigned int)
     149  T(7, ui, unsigned int)
     150  T(8, ui, unsigned int)
     151  T(9, ui, unsigned int)
     152  T(10, ui, unsigned int)
     153  T(11, ui, unsigned int)
     154  T(12, ui, unsigned int)
     155  T(13, ui, unsigned int)
     156  T(14, ui, unsigned int)
     157  T(15, ui, unsigned int)