Bug #80046 [Opn->Csd]: FREE for SWITCH_STRING optimized away

From: Date: Thu, 03 Sep 2020 09:18:45 +0000
Subject: Bug #80046 [Opn->Csd]: FREE for SWITCH_STRING optimized away
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228857@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80046&edit=1 ID: 80046 Updated by: nikic@php.net Reported by: sjon@php.net Summary: FREE for SWITCH_STRING optimized away -Status: Open +Status: Closed Type: Bug Package: opcache PHP Version: 8.0.0beta2 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=04e77d2dea03955b987bc6e253ea236c2c7a12aa Log: Fixed bug #80046 Previous Comments: ------------------------------------------------------------------------ [2020-09-03 08:40:59] nikic@php.net Slightly tweaked test case: <?php function test($foo) { switch ($foo . 'Bar') { case 'A': throw new Exception('A'); default: throw new Exception('Default'); } } try { test('Foo'); } catch (Exception $e) { echo $e->getMessage(), "\n"; } Asserts on master and 7.4. I had hoped it would show a leak on 7.3, but everything is alright there. The problem is that the FREE for the SWITCH_STRING is optimized away, which shouldn't happen, as it is a loop free. ------------------------------------------------------------------------ [2020-09-03 08:29:45] sjon@php.net repro: class a { protected function x(): bool { try { $credentials = something(); } catch (Exception $e) { switch (get_class($e)) { case Ex1::class: case Ex2::class: throw new Exception(''); default: throw $e; } } return true; } } ------------------------------------------------------------------------ [2020-09-03 08:19:25] sjon@php.net (gdb) print opline->opcode $1 = 188 '\274' ------------------------------------------------------------------------ [2020-09-03 08:17:13] nikic@php.net Can you check what the actual value of opline->opcode is? ------------------------------------------------------------------------ [2020-09-03 08:13:31] sjon@php.net Description: ------------ I'm seeing an assertion that doesn't really seem to be related to my code. I don't mind debugging this but the exception seems (..) somewhat self-explanatory. this in beta3 Test script: --------------- Zend/zend_opcode.c:773: keeps_op1_alive: Assertion `opline->opcode != 188 && opline->opcode != 78 && opline->opcode != 126 && opline->opcode != 155 && opline->opcode != 124 && opline->opcode != 182 && opline->opcode != 55' failed. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80046&edit=1

« previous php.bugs (#228857) next »