xref: /PHP-8.1/ext/opcache/tests/opt/gh11245_2.phpt (revision 5cad1a71)
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=
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13class X {
14    // Chosen to test for a memory leak.
15    static $prop = "aa";
16}
17switch (++X::$prop) {
18    default:
19        if (empty($xx)) {return;}
20}
21?>
22--EXPECTF--
23$_main:
24     ; (lines=7, args=0, vars=1, tmps=2)
25     ; (after optimizer)
26     ; %s
270000 T1 = PRE_INC_STATIC_PROP string("prop") string("X")
280001 T2 = ISSET_ISEMPTY_CV (empty) CV0($xx)
290002 JMPZ T2 0005
300003 FREE T1
310004 RETURN null
320005 FREE T1
330006 RETURN int(1)
34LIVE RANGES:
35     1: 0001 - 0005 (tmp/var)
36