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