xref: /php-src/ext/opcache/tests/jit/gh8030-001.phpt (revision c16ad918)
1--TEST--
2GH-8030: Segfault with JIT and large match/switch statements 001
3--EXTENSIONS--
4opcache
5--INI--
6opcache.enable=1
7opcache.enable_cli=1
8opcache.jit=1255
9opcache.file_update_protection=0
10opcache.revalidate_freq=0
11opcache.protect_memory=1
12--FILE--
13<?php
14function lookup($s){
15       return match($s){
16        1 => 1,
17        2 => 2,
18        3 => 3,
19        4 => 4,
20        5 => 5,
21        6 => 6,
22        7 => 7,
23        8 => 8,
24        9 => 9,
25        10 => 10,
26        11 => 11,
27        12 => 12,
28        13 => 13,
29        14 => 14,
30        15 => 15,
31        16 => 16,
32        17 => 17,
33        18 => 18,
34        19 => 19,
35        20 => 20,
36        21 => 21,
37        22 => 22,
38        23 => 23,
39        24 => 24,
40        25 => 25,
41        26 => 26,
42        27 => 27,
43        28 => 28,
44        29 => 29,
45        30 => 30,
46        31 => 31,
47        32 => 32,
48        33 => 33,
49        34 => 34,
50        35 => 35,
51        36 => 36,
52        37 => 37,
53        38 => 38,
54        39 => 39,
55        40 => 40,
56        41 => 41,
57        42 => 42,
58        43 => 43,
59        44 => 44,
60        45 => 45,
61        46 => 46,
62        47 => 47,
63        48 => 48,
64        49 => 49,
65        50 => 50,
66        51 => 51,
67        52 => 52,
68        53 => 53,
69        54 => 54,
70        55 => 55,
71        56 => 56,
72        57 => 57,
73        58 => 58,
74        59 => 59,
75        60 => 60,
76        61 => 61,
77        62 => 62,
78        63 => 63,
79        64 => 64,
80        65 => 65,
81        66 => 66,
82        67 => 67,
83        68 => 68,
84        69 => 69,
85        70 => 70,
86        71 => 71,
87        72 => 72,
88        73 => 73,
89        74 => 74,
90        75 => 75,
91        76 => 76,
92        77 => 77,
93        78 => 78,
94        79 => 79,
95        80 => 80,
96        81 => 81,
97        82 => 82,
98        83 => 83,
99        84 => 84,
100        85 => 85,
101        86 => 86,
102        87 => 87,
103        88 => 88,
104        89 => 89,
105        90 => 90,
106        91 => 91,
107        92 => 92,
108        93 => 93,
109        94 => 94,
110        95 => 95,
111        96 => 96,
112        97 => 97,
113        98 => 98,
114        99 => 99,
115        100 => 100,
116        101 => 101,
117        102 => 102,
118        103 => 103,
119        104 => 104,
120        105 => 105,
121        106 => 106,
122        107 => 107,
123        108 => 108,
124        109 => 109,
125        110 => 110,
126        111 => 111,
127        112 => 112,
128        113 => 113,
129        114 => 114,
130        115 => 115,
131        116 => 116,
132        117 => 117,
133        118 => 118,
134        119 => 119,
135        120 => 120,
136        121 => 121,
137        122 => 122,
138        123 => 123,
139        124 => 124,
140        125 => 125,
141        126 => 126,
142        127 => 127,
143        128 => 128,
144        129 => 129,
145        130 => 130,
146        131 => 131,
147        132 => 132,
148        133 => 133,
149        134 => 134,
150        135 => 135,
151        136 => 136,
152        137 => 137,
153        138 => 138,
154        139 => 139,
155        140 => 140,
156        141 => 141,
157        142 => 142,
158        143 => 143,
159        144 => 144,
160        145 => 145,
161        146 => 146,
162        147 => 147,
163        148 => 148,
164        149 => 149,
165        150 => 150,
166        151 => 151,
167        152 => 152,
168        153 => 153,
169        154 => 154,
170        155 => 155,
171        156 => 156,
172        157 => 157,
173        158 => 158,
174        159 => 159,
175        160 => 160,
176        161 => 161,
177        162 => 162,
178        163 => 163,
179        164 => 164,
180        165 => 165,
181        166 => 166,
182        167 => 167,
183        168 => 168,
184        169 => 169,
185        170 => 170,
186        171 => 171,
187        172 => 172,
188        173 => 173,
189        174 => 174,
190        175 => 175,
191        176 => 176,
192        177 => 177,
193        178 => 178,
194        179 => 179,
195        180 => 180,
196        181 => 181,
197        182 => 182,
198        183 => 183,
199        184 => 184,
200        185 => 185,
201        186 => 186,
202        187 => 187,
203        188 => 188,
204        189 => 189,
205        190 => 190,
206        191 => 191,
207        192 => 192,
208        193 => 193,
209        194 => 194,
210        195 => 195,
211        196 => 196,
212        197 => 197,
213        198 => 198,
214        199 => 199,
215        200 => 200,
216        201 => 201,
217        202 => 202,
218        203 => 203,
219        204 => 204,
220        205 => 205,
221        206 => 206,
222        207 => 207,
223        208 => 208,
224        209 => 209,
225        210 => 210,
226        211 => 211,
227        212 => 212,
228        213 => 213,
229        214 => 214,
230        215 => 215,
231        216 => 216,
232        217 => 217,
233        218 => 218,
234        219 => 219,
235        220 => 220,
236        221 => 221,
237        222 => 222,
238        223 => 223,
239        224 => 224,
240        225 => 225,
241        226 => 226,
242        227 => 227,
243        228 => 228,
244        229 => 229,
245        230 => 230,
246        231 => 231,
247        232 => 232,
248        233 => 233,
249        234 => 234,
250        235 => 235,
251        236 => 236,
252        237 => 237,
253        238 => 238,
254        239 => 239,
255        240 => 240,
256        241 => 241,
257        242 => 242,
258        243 => 243,
259        244 => 244,
260        245 => 245,
261        246 => 246,
262        247 => 247,
263        248 => 248,
264        249 => 249,
265        250 => 250,
266        251 => 251,
267        252 => 252,
268        253 => 253,
269        254 => 254,
270        255 => 255,
271        256 => 256,
272        257 => 257,
273        258 => 258,
274        259 => 259,
275        260 => 260,
276        261 => 261,
277        262 => 262,
278        263 => 263,
279        264 => 264,
280        265 => 265,
281        266 => 266,
282        267 => 267,
283        268 => 268,
284        269 => 269,
285        270 => 270,
286        271 => 271,
287        272 => 272,
288        273 => 273,
289        274 => 274,
290        275 => 275,
291        276 => 276,
292        277 => 277,
293        278 => 278,
294        279 => 279,
295        280 => 280,
296        281 => 281,
297        282 => 282,
298        283 => 283,
299        284 => 284,
300        285 => 285,
301        286 => 286,
302        287 => 287,
303        288 => 288,
304        289 => 289,
305        290 => 290,
306        291 => 291,
307        292 => 292,
308        293 => 293,
309        294 => 294,
310        295 => 295,
311        296 => 296,
312        297 => 297,
313        298 => 298,
314        299 => 299,
315        300 => 300,
316        301 => 301,
317        302 => 302,
318        303 => 303,
319        304 => 304,
320        305 => 305,
321        306 => 306,
322        307 => 307,
323        308 => 308,
324        309 => 309,
325        310 => 310,
326        311 => 311,
327        312 => 312,
328        313 => 313,
329        314 => 314,
330        315 => 315,
331        316 => 316,
332        317 => 317,
333        318 => 318,
334        319 => 319,
335        320 => 320,
336        321 => 321,
337        322 => 322,
338        323 => 323,
339        324 => 324,
340        325 => 325,
341        326 => 326,
342        327 => 327,
343        328 => 328,
344        329 => 329,
345        330 => 330,
346        331 => 331,
347        332 => 332,
348        333 => 333,
349        334 => 334,
350        335 => 335,
351        336 => 336,
352        337 => 337,
353        338 => 338,
354        339 => 339,
355        340 => 340,
356        341 => 341,
357        342 => 342,
358        343 => 343,
359        344 => 344,
360        345 => 345,
361        346 => 346,
362        347 => 347,
363        348 => 348,
364        349 => 349,
365        350 => 350,
366        351 => 351,
367        352 => 352,
368        353 => 353,
369        354 => 354,
370        355 => 355,
371        356 => 356,
372        357 => 357,
373        358 => 358,
374        359 => 359,
375        360 => 360,
376        361 => 361,
377        362 => 362,
378        363 => 363,
379        364 => 364,
380        365 => 365,
381        366 => 366,
382        367 => 367,
383        368 => 368,
384        369 => 369,
385        370 => 370,
386        371 => 371,
387        372 => 372,
388        373 => 373,
389        374 => 374,
390        375 => 375,
391        376 => 376,
392        377 => 377,
393        378 => 378,
394        379 => 379,
395        380 => 380,
396        381 => 381,
397        382 => 382,
398        383 => 383,
399        384 => 384,
400        385 => 385,
401        386 => 386,
402        387 => 387,
403        388 => 388,
404        389 => 389,
405        390 => 390,
406        391 => 391,
407        392 => 392,
408        393 => 393,
409        394 => 394,
410        395 => 395,
411        396 => 396,
412        397 => 397,
413        398 => 398,
414        399 => 399,
415        400 => 400,
416        401 => 401,
417        402 => 402,
418        403 => 403,
419        404 => 404,
420        405 => 405,
421        406 => 406,
422        407 => 407,
423        408 => 408,
424        409 => 409,
425        410 => 410,
426        411 => 411,
427        412 => 412,
428        413 => 413,
429        414 => 414,
430        415 => 415,
431        416 => 416,
432        417 => 417,
433        418 => 418,
434        419 => 419,
435        420 => 420,
436        421 => 421,
437        422 => 422,
438        423 => 423,
439        424 => 424,
440        425 => 425,
441        426 => 426,
442        427 => 427,
443        428 => 428,
444        429 => 429,
445        430 => 430,
446        431 => 431,
447        432 => 432,
448        433 => 433,
449        434 => 434,
450        435 => 435,
451        436 => 436,
452        437 => 437,
453        438 => 438,
454        439 => 439,
455        440 => 440,
456        441 => 441,
457        442 => 442,
458        443 => 443,
459        444 => 444,
460        445 => 445,
461        446 => 446,
462        447 => 447,
463        448 => 448,
464        449 => 449,
465        450 => 450,
466        451 => 451,
467        452 => 452,
468        453 => 453,
469        454 => 454,
470        455 => 455,
471        456 => 456,
472        457 => 457,
473        458 => 458,
474        459 => 459,
475        460 => 460,
476        461 => 461,
477        462 => 462,
478        463 => 463,
479        464 => 464,
480        465 => 465,
481        466 => 466,
482        467 => 467,
483        468 => 468,
484        469 => 469,
485        470 => 470,
486        471 => 471,
487        472 => 472,
488        473 => 473,
489        474 => 474,
490        475 => 475,
491        476 => 476,
492        477 => 477,
493        478 => 478,
494        479 => 479,
495        480 => 480,
496        481 => 481,
497        482 => 482,
498        483 => 483,
499        484 => 484,
500        485 => 485,
501        486 => 486,
502        487 => 487,
503        488 => 488,
504        489 => 489,
505        490 => 490,
506        491 => 491,
507        492 => 492,
508        493 => 493,
509        494 => 494,
510        495 => 495,
511        496 => 496,
512        497 => 497,
513        498 => 498,
514        499 => 499,
515        500 => 500,
516        501 => 501,
517        502 => 502,
518        503 => 503,
519        504 => 504,
520        505 => 505,
521        506 => 506,
522        507 => 507,
523        508 => 508,
524        509 => 509,
525        510 => 510,
526        511 => 511,
527        512 => 512,
528        513 => 513,
529    };
530}
531for ($i=0; $i<2; $i++){
532    var_dump(lookup(510));
533    var_dump(lookup(513));
534}
535?>
536==DONE==
537--EXPECT--
538int(510)
539int(513)
540int(510)
541int(513)
542==DONE==
543