Edit report at http://bugs.php.net/bug.php?id=53632&edit=1
ID: 53632 Updated by: ras...@php.net Reported by: exploringbinary at gmail dot com Summary: PHP hangs on numeric value 2.2250738585072011e-308 Status: Assigned Type: Bug Package: Math related PHP Version: 5.3.4 Assigned To: dmitry Block user comment: N Private report: N New Comment: Guys, we already know the problem. We are hitting an annoying x87 FPU design flaw. You can read all about it here if you are interested: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 And there is a good paper on it here: http://hal.archives-ouvertes.fr/docs/00/28/14/29/PDF/floating-point-article.pdf We don't need any more compile reports. If you are on an architecture that uses the x87 FPU and you haven't forced SSE or float-store then you will see this problem. Previous Comments: ------------------------------------------------------------------------ [2011-01-04 19:11:29] hieu dot ld at vnnb dot net Re: last comment, I believe "-mfpmath=sse" did the trick. apologies for cluttering the bug report. ------------------------------------------------------------------------ [2011-01-04 19:06:34] hieu dot ld at vnnb dot net Does not reproduce on php 5.3.4 (with gentoo patches, compiled -O2). dri...@undine ~/h $ cat numericval.php <?php $d = 2.2250738585072011e-308; echo $d + 0; echo "\n"; ?> dri...@undine ~/h $ php numericval.php 2.2250738585072E-308 dri...@undine ~/h $ php -v PHP 5.3.4-pl0-gentoo (cli) (built: Dec 24 2010 14:24:29) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies dri...@undine ~/h $ uname -a Linux undine 2.6.28-hardened-r9-hrd-undine #1 SMP Thu Nov 12 02:29:42 CET 2009 i686 Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz GenuineIntel GNU/Linux Configure Command => './configure' '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--prefix=/usr/lib/php5.3' '--mandir=/usr/lib/php5.3/man' '--infodir=/usr/lib/php5.3/info' '--libdir=/usr/lib/php5.3/lib' '--with-libdir=lib' '--without-pear' '--enable-maintainer-zts' '--disable-bcmath' '--with-bz2' '--disable-calendar' '--with-curl' '--without-curlwrappers' '--without-enchant' '--enable-exif' '--enable-ftp' '--with-gettext' '--without-gmp' '--disable-intl' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--without-mssql' '--with-onig=/usr' '--with-openssl' '--with-openssl-dir=/usr' '--enable-pcntl' '--with-pgsql' '--without-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--disable-soap' '--disable-sockets' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--with-tidy' '--disable-wddx' '--with-xmlrpc' '--without-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--enable-dba' '--without-cdb' '--without-db4' '--disable-flatfile' '--with-gdbm' '--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-imap' '--with-imap-ssl' '--without-interbase' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=/usr/bin/mysql_config' '--without-oci8' '--without-pdo-dblib' '--with-pdo-mysql=/usr' '--with-pdo-pgsql' '--with-pdo-sqlite=/usr' '--without-pdo-odbc' '--with-readline' '--without-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8' '--with-pic' '--with-pcre-regex=/usr' '--with-pcre-dir=/usr' '--with-config-file-path=/etc/php/cli-php5.3' '--with-config-file-scan-dir=/etc/php/cli-php5.3/ext-active' '--enable-cli' '--disable-cgi' '--disable-fpm' '--disable-embed' '--without-apxs2' CFLAGS="-march=core2 -mfpmath=sse -O2 -pipe -fforce-addr -fomit-frame-pointer" ------------------------------------------------------------------------ [2011-01-04 18:36:42] chris dot tandiono at gmail dot com [christandi...@hang1 ~]$ uname -a FreeBSD hang1 8.0-RELEASE-p3 FreeBSD 8.0-RELEASE-p3 #0: Wed May 26 05:45:12 UTC 2010 r...@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386 [christandi...@hang1 ~]$ php -v PHP 5.3.4 with Suhosin-Patch (cli) (built: Dec 20 2010 18:00:57) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies [ch...@hang2 ~]$ uname -a Linux hang2 2.6.36-ARCH #1 SMP PREEMPT Wed Nov 24 06:44:11 UTC 2010 i686 Intel(R) Core(TM) Duo CPU T2400 @ 1.83GHz GenuineIntel GNU/Linux [ch...@hang2 ~]$ php -v PHP 5.3.4 with Suhosin-Patch (cli) (built: Dec 16 2010 21:19:01) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies [ch...@nohang ~]$ uname -a Darwin nohang 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov 5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 i386 i386 [ch...@nohang ~]$ php -v PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:57) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies Hangs on FreeBSD and Linux, not on Mac OS X. It might be worth noting that the last two machines have the same CPU (the Linux and Mac OS X machines). ------------------------------------------------------------------------ [2011-01-04 17:55:00] hion2000 at yahoo dot ca Same happens on my Ubuntu box as well. $ php -v PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010 14:17:04) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies $ uname -a Linux Server2 2.6.35-23-generic-pae #41-Ubuntu SMP Wed Nov 24 10:35:46 UTC 2010 i686 GNU/Linux ------------------------------------------------------------------------ [2011-01-04 17:41:03] ras...@php.net This is an interesting bug. How about we just mark these as volatile doubles in that part of the code to make sure they don't end up in registers. My guess is that it would fix it. Need to track down a 32-bit machine to test this though. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=53632 -- Edit this bug report at http://bugs.php.net/bug.php?id=53632&edit=1