[php-src] PR #26055: DCE: keep dead ADD_ARRAY_ELEMENTs that may read undefined CVs

From: Date: Fri, 04 Dec 2026 03:50:45 +0000
Subject: [php-src] PR #26055: DCE: keep dead ADD_ARRAY_ELEMENTs that may read undefined CVs
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41401@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/26055 Author: fQwQf ## Description may_have_side_effects() returned false for ZEND_ADD_ARRAY_ELEMENT unless both operands were VAR/TMP (the free-ordering TODO case from dce_011.phpt). When a dead array construction has CV operands that may be undefined ($r = [$x, $y]; with $r unused), DCE removed the tail ADD_ARRAY_ELEMENTs, dropping their "Undefined variable" diagnostics while the head one was kept. Treat the instruction as having side effects when op1 or op2 is a CV whose type includes MAY_BE_UNDEF, mirroring the ZEND_CHECK_VAR case in the same function. ## Tests ext/opcache/tests/opt/dce_add_array_element_undef_cv.phpt (added): both warnings are now emitted under opcache, matching the interpreter. Also verified against a 940-program differential corpus (opcache on/off/JIT): 0 differentials, 0 ASan reports.

« previous php.git-pulls (#41401) next »