#45215 [Fbk->Opn]: php_gmp.dll uses exotic instructions

From: Date: Mon, 09 Jun 2008 15:23:02 +0000
Subject: #45215 [Fbk->Opn]: php_gmp.dll uses exotic instructions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125606@lists.php.net to get a copy of this message
ID: 45215 User updated by: shaunspiller at gmail dot com Reported By: shaunspiller at gmail dot com -Status: Feedback +Status: Open Bug Type: Reproducible crash Operating System: Win32 PHP Version: 5.2.6 Assigned To: pajoye New Comment: Thanks for the feedback. I can understand it's not reasonable to degrade the GMP binaries for such old systems. Documenting it would have saved me a lot of confusion though. Yes I'm using Windows 98 SE at the moment, although hope to be back on Windows 2003 soon. Exactly the same problem with PHP versions 5.2.6 and 5.1.6. Ideally, perhaps the GMP module should check on load to see if 686+ instructions are supported, and if not, fail to load gracefully by returning an error message to PHP, rather than just crashing the whole program. Is that possible? Previous Comments: ------------------------------------------------------------------------ [2008-06-09 14:51:17] pajoye@php.net "I'm using the latest precompiled Win32 binaries of PHP-5.2.6 (and have also tried PHP-5.1.6) and get a program crash with an #Undefined Opcode exception when loading php_gmp.dll." Do you mean that you get the same issue with 5.1.6? I think yes as the gmp library has not been changed since 5.1.6. About win9x support, which OS do you use? You may know that we plan to drop win9x support for 5.3+, only 2k+ will be supported. About i386 support, especially with GMP there is a real improvement by using 686+, see the gmp website for a detailed list. And finally good point about the documentation, we should document it asap. ------------------------------------------------------------------------ [2008-06-09 14:29:25] shaunspiller at gmail dot com Description: ------------ I'm using the latest precompiled Win32 binaries of PHP-5.2.6 (and have also tried PHP-5.1.6) and get a program crash with an #Undefined Opcode exception when loading php_gmp.dll. I know what the problem is and I'm not sure if one would consider it a bug or not since it will only happen on very old machines, but I can't believe I'm the first person to have ever encountered this. The instruction in php_gmp.dll which causes the crash is CMOVZ EDX, EAX. The conditional move instructions were only added with the Pentium Pro. Tough luck for me -- my computer literally blew up last week and I'm stuck temporarally with a Pentium MMX and a K6 laptop, neither of which support CMOVcc. It's understandable that compiling for P6+ instructions might be a good tradeoff between performance and compatibility, but current versions of PHP are *stated* to work with even Windows 98 and up, and so are the precompiled binaries (other extensions seem to work just fine). I don't know how much CMOVcc is relied on in php_gmp.dll, and changing the build options to use generic I386+ might be undesirable, but the P6 instruction set requirement should at least be *mentioned* somewhere, and it isn't (not that I found). Disappointing for me in either case, because recompiling the DLL is a little beyond what I can do on this old system right now. I would normally have just used BCMath instead, but I need the base-conversion stuff, which that doesn't have. Reproduce code: --------------- <?php dl('php_gmp.dll'); echo 'hi!'; ?> Expected result: ---------------- hi! Actual result: -------------- Instant program crash. Windows provides the following info: PHP executed an invalid instruction in module PHP_GMP.DLL at 0187:01a760f4. Registers: EAX=01a7ced0 CS=0187 EIP=01a760f4 EFLGS=00010202 EBX=01a710e0 SS=018f ESP=00d3f904 EBP=01989c20 ECX=01a710c0 DS=018f ESI=0000001a FS=12c7 EDX=01a710b0 ES=018f EDI=01370ae0 GS=0000 Bytes at CS:EIP: 0f 44 d0 b8 60 cf a7 01 85 c9 0f 44 c8 85 db b8 Stack dump: 1001a380 01a710a4 01a710b0 01a710c0 01a710e0 01a8c2f0 0000000c 01a76120 00000003 0000001a 01370ae0 01a8c2fc 00000013 00000002 00000003 0000001a ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45215&edit=1

« previous php.bugs (#125606) next »