xref: /PHP-8.2/ext/opcache/tests/opt/gh11245_2.phpt (revision e48a5c14)
1--TEST--
2GH-11245: In some specific cases SWITCH with one default statement will cause segfault (TMP variation)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=0x7FFFBFFF
7opcache.opt_debug_level=0x20000
8opcache.preload=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14class X {
15    // Chosen to test for a memory leak.
16    static $prop = "aa";
17}
18switch (++X::$prop) {
19    default:
20        if (empty($xx)) {return;}
21}
22?>
23--EXPECTF--
24$_main:
25     ; (lines=7, args=0, vars=1, tmps=2)
26     ; (after optimizer)
27     ; %s
280000 T1 = PRE_INC_STATIC_PROP string("prop") string("X")
290001 T2 = ISSET_ISEMPTY_CV (empty) CV0($xx)
300002 JMPZ T2 0005
310003 FREE T1
320004 RETURN null
330005 FREE T1
340006 RETURN int(1)
35LIVE RANGES:
36     1: 0001 - 0005 (tmp/var)
37