1/* { dg-do compile }  */
2/* { dg-additional-options "-fpic -std=c99" }  */
3/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
4
5typedef unsigned int size_t;
6typedef struct
7{
8  unsigned long __val[(1024 / (8 * sizeof (unsigned long)))];
9}  __sigset_t;
10struct __jmp_buf_tag
11{
12  __sigset_t __saved_mask;
13};
14typedef struct __jmp_buf_tag sigjmp_buf[1];
15struct stat
16{
17  long long st_dev;
18  unsigned short int __pad1;
19  int tm_isdst;
20  long int tm_gmtoff;
21  char *tm_zone;
22};
23
24typedef size_t STRLEN;
25typedef struct op OP;
26typedef struct cop COP;
27typedef struct interpreter PerlInterpreter;
28typedef struct sv SV;
29typedef struct av AV;
30typedef struct cv CV;
31typedef struct gp GP;
32typedef struct gv GV;
33typedef struct xpv XPV;
34typedef struct xpvio XPVIO;
35typedef union any ANY;
36typedef unsigned char U8;
37typedef long I32;
38typedef unsigned long U32;
39typedef U32 line_t;
40typedef struct _PerlIO PerlIOl;
41typedef PerlIOl *PerlIO;
42struct sv
43{
44  void *sv_any;
45  U32 sv_flags;
46  union
47  {
48    char *svu_pv;
49  } sv_u;
50};
51struct gv
52{
53  U32 sv_flags;
54  union
55  {
56    GP *svu_gp;
57  } sv_u;
58};
59struct io
60{
61  XPVIO *sv_any;
62};
63struct xpv
64{
65  STRLEN xpv_cur;
66};
67struct xpvio
68{
69  PerlIO *xio_ofp;
70};
71struct gp
72{
73  SV *gp_sv;
74  struct io *gp_io;
75};
76struct jmpenv
77{
78  struct jmpenv *je_prev;
79  sigjmp_buf je_buf;
80  int je_ret;
81};
82typedef struct jmpenv JMPENV;
83struct cop
84{
85  line_t cop_line;
86  struct refcounted_he *cop_hints_hash;
87};
88struct interpreter
89{
90  SV **Istack_sp;
91  OP *Iop;
92  SV **Icurpad;
93  SV **Istack_base;
94  SV **Istack_max;
95  I32 *Iscopestack;
96  I32 Iscopestack_ix;
97  I32 Iscopestack_max;
98  ANY *Isavestack;
99  I32 Isavestack_ix;
100  I32 Isavestack_max;
101  SV **Itmps_stack;
102  I32 Itmps_ix;
103  I32 Itmps_floor;
104  I32 Itmps_max;
105  I32 Imodcount;
106  I32 *Imarkstack;
107  I32 *Imarkstack_ptr;
108  I32 *Imarkstack_max;
109  SV *ISv;
110  XPV *IXpv;
111  STRLEN Ina;
112  struct stat Istatbuf;
113  struct stat Istatcache;
114  OP *Irestartop;
115  COP *volatile Icurcop;
116  JMPENV *Itop_env;
117  U8 Iexit_flags;
118  I32 Istatusvalue;
119  I32 Istatusvalue_posix;
120  GV *Istderrgv;
121  GV *Ierrgv;
122  AV *Ibeginav;
123  AV *Iunitcheckav;
124  COP Icompiling;
125  char Isavebegin;
126  volatile U32 Idebug;
127  AV *Ibeginav_save;
128  AV *Icheckav_save;
129  AV *Iunitcheckav_save;
130};
131
132void S_my_exit_jump (PerlInterpreter *my_perl __attribute__((unused)))
133  __attribute__((noreturn));
134
135int Perl_av_len (PerlInterpreter*, AV*);
136void Perl_av_create_and_push (PerlInterpreter*, AV**, SV*);
137int __sigsetjmp (sigjmp_buf env, int savemask);
138void Perl_sv_2pv_flags (PerlInterpreter*, SV*, STRLEN*, int);
139void Perl_deb (PerlInterpreter*,
140	       const char*, const char*, int, const char*, int);
141void Perl_croak (PerlInterpreter*, const char*, void*);
142void foo (void);
143
144void
145Perl_call_list (PerlInterpreter *my_perl __attribute__((unused)),
146		I32 oldscope, AV *paramList)
147{
148  SV *atsv;
149  CV *cv;
150  STRLEN len;
151  int ret;
152  JMPENV cur_env;
153  GV *shplep;
154  volatile line_t oldline;
155
156  oldline = (my_perl->Icurcop) ? my_perl->Icurcop->cop_line : 0;
157
158  while (Perl_av_len (my_perl, paramList) >= 0)
159    {
160      if (my_perl->Isavebegin)
161	{
162	  if (paramList == my_perl->Ibeginav)
163	    {
164	      Perl_av_create_and_push (my_perl, &my_perl->Ibeginav_save,
165				       (SV*) cv);
166	      Perl_av_create_and_push(my_perl, &my_perl->Icheckav_save,
167				      (SV*) cv);
168	    }
169	  else if (paramList == my_perl->Iunitcheckav)
170	    Perl_av_create_and_push(my_perl, &my_perl->Iunitcheckav_save,
171				    (SV*) cv);
172	}
173
174      cur_env.je_ret = __sigsetjmp (cur_env.je_buf, 0);
175
176      switch (ret)
177	{
178	case 0:
179	  shplep = (GV *) my_perl->Ierrgv;
180	  *my_perl->Imarkstack_ptr = my_perl->Istack_sp - my_perl->Istack_base;
181	  atsv = shplep->sv_u.svu_gp->gp_sv;
182	  if (atsv->sv_flags & 0x00000400 == 0x00000400)
183	    len = ((XPV*) ((SV *) atsv)->sv_any)->xpv_cur;
184	  else
185	    Perl_sv_2pv_flags (my_perl, atsv, &len, 2|32);
186
187	  if (len)
188	    {
189	      my_perl->Icurcop = &my_perl->Icompiling;
190	      while (my_perl->Iscopestack_ix > oldscope)
191		{
192		  if (my_perl->Idebug & 0x00000004)
193		    Perl_deb (my_perl, "scope", "LEAVE",
194			      my_perl->Iscopestack_ix, "perl.c", 5166);
195		  (my_perl->Itop_env) = cur_env.je_prev;
196		}
197
198	      Perl_croak (my_perl, "%""-p""", (void*) atsv);
199	    }
200
201	case 1:
202	  my_perl->Istatusvalue = 1;
203	  my_perl->Istatusvalue_posix = 1;
204	case 2:
205	  while (my_perl->Iscopestack_ix > oldscope)
206	    if (my_perl->Idebug & 0x00000004)
207	      foo ();
208	  my_perl->Icurcop = &my_perl->Icompiling;
209	  my_perl->Icurcop->cop_line = oldline;
210	  if (my_perl->Idebug & 0x00000004)
211	    foo ();
212	  S_my_exit_jump (my_perl);
213	case 3:
214	  if (my_perl->Irestartop)
215	    foo ();
216	}
217    }
218}
219