From: craig dot mohrman at oracle dot com Operating system: Solaris 11 PHP version: Irrelevant Package: opcache Bug Type: Bug Bug description:Zend Opcache on Solaris 11 x86 needs ZEND_MM_ALIGNMENT=4
Description: ------------ This is a place holder bug for anyone working with Solaris and php 5.3.27 I haven't tried the latest version of PHP so maybe this just goes away. I've documented this in a thread here: https://github.com/zendtech/ZendOptimizerPlus/issues/122 But the problem appears to be in php itself. This is compiling the Zend Opcache 7.0.2 from: http://pecl.php.net/package/ZendOpcache When compiling ZendOpcache with php 5.3.27 on Solaris 11 x86 with the Solaris Studio compiler (12.1) I'm seeing Overflown errors even with the most trivial of php programs. This is all being done in 32-bit. Sparc has no such issue. Works out of the box. As a workaround I'm patching ZEND_MM_ALIGNMENT: #define ZEND_MM_ALIGNMENT 8 #define ZEND_MM_ALIGNMENT_LOG2 3 to #define ZEND_MM_ALIGNMENT 4 #define ZEND_MM_ALIGNMENT_LOG2 2 over in PHP/Zend/Zend.m4 and everything works fine. I got this 4 when compiling php 5.3.27 with gcc 4.5. That comes up with ZEND_MM_ALIGNMENT=4 but when compiling with Solaris Studio I get ZEND_MM_ALIGNMENT=8. Oddly on Solaris sparc both Solaris Studio and gcc 4.5 come up with: ZEND_MM_ALIGNMENT=8 but that works fine. So see the actual patch below. This is not the solution but gets Zend Opcache working on Solaris x86. Test script: --------------- $ cat simple.php <?php function m_x_plus_b($m, $x, $b) { return $m*$x+$b; } $slope=1.5; $x=2; $b=3; echo "y = ".m_x_plus_b($slope,$x,$b)."\n<br>"; ?> Expected result: ---------------- $ php -v PHP 5.3.27 (cli) (built: Aug 20 2013 11:05:05) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.2, Copyright (c) 1999-2013, by Zend Technologies with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH $ php -f simple.php y = 6 <br> Actual result: -------------- $ php -f simple.php File /home/cmohrman/Public/PHP/simple.php func m_x_plus_b Block: 0-5 (6) unused Block: 6-6 (1) T0: 0 T1: 0 Opt Block: 0-5 (6) T0: 0 T1: 0 Opt Block: 0-5 (6) T0: 0 T1: 0 Opt Block: 0-5 (6) T0: 0 T1: 0 Out Block: 0-5 (6) File /home/cmohrman/Public/PHP/simple.php func main Block: 0-11 (12) unused T0: 0 T1: 0 T2: 0 T3: 0 T4: 0 T5: 0 [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(2053) : Block 0x0935e970 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:1911, 6 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x530646BC) 1 byte(s) overflown --------------------------------------- Opt Block: 0-11 (12) [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(1220) : Block 0x0935fa70 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:631, 24 bytes) Start: OK End: Overflown (magic=0xFFFFFFB4 instead of 0x530646BC) At least 4 bytes overflown --------------------------------------- T0: 0 T1: 0 T2: 0 T3: 0 T4: 0 T5: 0 [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(2053) : Block 0x0935e9a8 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:1911, 6 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x530646BC) 1 byte(s) overflown --------------------------------------- Opt Block: 1-11 (11) [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(1220) : Block 0x0935fc80 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:631, 24 bytes) Start: OK End: Overflown (magic=0xFFFFFFB4 instead of 0x530646BC) At least 4 bytes overflown --------------------------------------- T0: 0 T1: 0 T2: 0 T3: 0 T4: 0 T5: 0 [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(2053) : Block 0x0935e9e0 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:1911, 6 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x530646BC) 1 byte(s) overflown --------------------------------------- Opt Block: 1-11 (11) [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(1220) : Block 0x0935ea50 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:631, 24 bytes) Start: OK End: Overflown (magic=0xFFFFFFB4 instead of 0x530646BC) At least 4 bytes overflown --------------------------------------- T0: 0 T1: 0 T2: 0 T3: 0 T4: 0 T5: 0 [Fri Aug 9 11:10:45 2013] Script: '/home/cmohrman/Public/PHP/simple.php' --------------------------------------- ./Optimizer/block_pass.c(2053) : Block 0x0935ea18 status: Beginning: OK (allocated on ./Optimizer/block_pass.c:1911, 6 bytes) Start: OK End: Overflown (magic=0x00000000 instead of 0x530646BC) 1 byte(s) overflown --------------------------------------- Out Block: 0-10 (11) Segmentation Fault (core dumped) $ mdb core Loading modules: [ libc.so.1 libuutil.so.1 libnvpair.so.1 ld.so.1 ] > ::stack opcache.so`optimize_temporary_variables+0x504(935cdf0, 0) opcache.so`zend_optimizer+0x2c3d(935cdf0, 0) opcache.so`accel_op_array_handler+0x80(935cdf0, 0, 4c, 8af6905) php`zend_extension_op_array_handler+0x1b(93fc4e0, 935cdf0, fea392d8, 8af3d21) php`zend_llist_apply_with_argument+0x31(91e7b60, 8af6a8c, 935cdf0, 8af6ac5) php`pass_two+0xac(935cdf0, 0, fea39448, 8aa0e38) php`compile_file+0x5d9(fea3a400, 8, fea39620, 86a67dc) php`phar_compile_file+0x370(fea3a400, 8) opcache.so`compile_and_cache_file+0x424(fea3a400, 8, f8764444, 26, fea39950, fea39954) opcache.so`persistent_compile_file+0x750(fea3a400, 8, 8058b50, 8b16131) php`zend_execute_scripts+0x2da(8, 0, 3, 0, fea3a400, 0) php`php_execute_script+0x3a8(fea3a400, 918f000, fea3a8c8, 8c94507) php`main+0x15d6(3, fea3a8fc, fea3a90c, f8aa9940) _start+0x7d(3, fea3a9fc, fea3aa00, fea3aa03, 0, fea3aa0e) > -- Edit bug report at https://bugs.php.net/bug.php?id=65561&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65561&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65561&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65561&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65561&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65561&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65561&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65561&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65561&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65561&r=support Expected behavior: https://bugs.php.net/fix.php?id=65561&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65561&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65561&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65561&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65561&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65561&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65561&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65561&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65561&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65561&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65561&r=mysqlcfg