php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20542 0+0=4G on aix4.3 (64bits)
Submitted: 2002-11-21 05:45 UTC Modified: 2002-12-13 02:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rvl at interchain dot nl Assigned:
Status: Closed Package: Math related
PHP Version: 4.2.3 OS: aix 4.3.3.0
Private report: No CVE-ID: None
 [2002-11-21 05:45 UTC] rvl at interchain dot nl
Script:
	<?
	echo '0+0=', 0+0, "\n";
	?>

Output of script on php 4.2.3:

	0+0=4294967294

which is equal to 2^32-2

(Output of script on php 4.1.2 and 4.0.6:
	0+0=4294967296
which is equal to 2^32).

In general, all simple additions and multiplications produce huge numbers:

	0+0=4294967294
	0+1=4294967295
	1+0=4294967295
	1+1=4294967296
	0-0=0
	0-1=-1
	1-0=1
	1-1=0
	0*0=3.5178585246345E+18
	0*1=3.5178585265101E+18
	1*0=3.5178585265101E+18
	1*1=3.5178585283857E+18
	0/1=0
	1/1=1
	2/1=2
	2/2=1

Installation issues
# gcc -v
Reading specs from /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.3.0/2.95.3/specs
gcc version 2.95.3 20010315 (release)
# make -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for rs6000-ibm-aix4.3.3.0
# tar -xf apache_1.3.20.tar
# cd apache_1.3.20
# ./configure --enable-module=most
# cd ..
# tar -xf php-4.2.3.tar
# cd php-4.2.3
# ./configure --without-mysql --with-apache=../apache_1.3.20 --enable-static --with-iodbc=/usr/local --enable-track-vars
# make
# make install
# cd ..
# cd apache_1.3.20
# configure --enable-module=most --activate-module=src/modules/php4/libphp4.a
# make
# make install

I don't know if it is very relevant but the rs6000 on which aix4.3 is running
is a 64bits machine. The c program
	int main()
	{
		printf("long=%dbits\n",8*sizeof(long));
		return 0;
	}
outputs 'long=64bits' when compiled with 'cc -q64', while when compiled
with 'gcc' it outputs 'long=32bits'.

Thanks very much in advance,
Rein van Vliet

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-21 17:25 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

string cancatination is done using . not , in PHP.
<?php
echo '0+0=' .  (0+0) .  "\n";
?>
Results in 0 on any platform.
 [2002-11-22 02:47 UTC] rvl at interchain dot nl
I am sorry but on this specific platform
<?php echo (0+0); ?> does result in 4294967294, really!
And <?php $x = 0; $x = $x + 0; echo $x; ?> as well.
 [2002-11-27 18:54 UTC] iliaa@php.net
Could this be an issue with the C library used on AIX? On a 64 bit platform (64sparc) I cannot replicate the problem using PHP 4.2.3.
 [2002-12-13 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-12-13 02:25 UTC] rvl at interchain dot nl
Seems a gcc bug.
Now PHP compiled with the native AIX C compiler
(and apache still compiled with gcc)
and it works.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 04:03:13 2021 UTC