Skip to content

Commit 9bf1e53

Browse files
committed
[skip ci] Explain in comment why match default arm is emitted first
1 parent 6085c82 commit 9bf1e53

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5297,6 +5297,8 @@ void zend_compile_match(znode *result, zend_ast *ast)
52975297
uint32_t cond_count = 0;
52985298
uint32_t *jmp_end_opnums = safe_emalloc(sizeof(uint32_t), arms->children, 0);
52995299

5300+
// The default arm is emitted first to avoid live range issues where the tmpvar for the
5301+
// arm result is freed even though it has not been initialized yet.
53005302
if (!has_default_arm) {
53015303
if (!uses_jumptable) {
53025304
zend_update_jump_target_to_next(opnum_default_jmp);

0 commit comments

Comments
 (0)