Bug #17449 Updated: sort() does not work

From: Date: Fri, 07 Jun 2002 16:48:50 +0000
Subject: Bug #17449 Updated: sort() does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9778@lists.php.net to get a copy of this message
 ID:               17449
 Updated by:       mfischer@php.net
 Reported By:      nohn@php.net
 Status:           Feedback
 Bug Type:         Arrays related
 Operating System: Digital UNIX V4.0G (Rev. 1530)
 PHP Version:      4.2.1
 New Comment:

STABLE != HEAD, you have to try the non-STABLE snapshot.



Previous Comments:
------------------------------------------------------------------------

[2002-06-07 11:57:04] michael.mauch@gmx.de

Still does not sort with php4-STABLE-200206070600.

bash-2.01$ php   
<?php
$a = array(9,7,3,5);
sort($a);
print_r($a);
?>

X-Powered-By: PHP/4.2.2-dev
Content-type: text/html

Array
(
    [0] => 9
    [1] => 7
    [2] => 3
    [3] => 5
)

------------------------------------------------------------------------

[2002-05-28 06:55:19] michael.mauch@gmx.de

php4-200205280000.tar.gz doesn't compile here:

% configure --prefix=/Team/local
[...]
gcc  -Imain/ -I/Team/local/src/php4-200205280000/main/ -DPHP_ATOM_INC
-I/Team/local/src/php4-200205280000/include
-I/Team/local/src/php4-200205280000/main
-I/Team/local/src/php4-200205280000
-I/Team/local/src/php4-200205280000/Zend
-I/Team/local/src/php4-200205280000/ext/xml/expat 
-I/Team/local/src/php4-200205280000/TSRM -g -O2  -c
/Team/local/src/php4-200205280000/main/user_streams.c -o
main/user_streams.o  && echo > main/user_streams.lo
In file included from
/usr/local/lib/gcc-lib/alphaev6-dec-osf4.0f/2.95.2/include/stdarg.h:36,
                 from
/Team/local/src/php4-200205280000/Zend/zend.h:59,
                 from /Team/local/src/php4-200205280000/main/php.h:34,
                 from
/Team/local/src/php4-200205280000/main/user_streams.c:22:
/usr/local/lib/gcc-lib/alphaev6-dec-osf4.0f/2.95.2/include/va-alpha.h:36:
warning: redefinition of `va_list'
/usr/local/lib/gcc-lib/alphaev6-dec-osf4.0f/2.95.2/include/va_list.h:7:
warning: `va_list' previously declared here
Make:  Don't know how to make /zend_language_parser.c.  Stop.

Zend/zend_language_parser.c exists, but the Makefile searches for
/zend_language_parser.c and several other files in /.

------------------------------------------------------------------------

[2002-05-27 17:28:23] mfischer@php.net

This may be related to a casting problem which is supposed to be fixed
in HEAD, please try this version (snapshots are available at
snaps.php.net), thx.

------------------------------------------------------------------------

[2002-05-27 17:19:01] mfischer@php.net

4.2.0RC1 introduced the new sorting code Zend/zend_qsort.c from
Sterling, maybe that's related?

------------------------------------------------------------------------

[2002-05-27 15:42:16] michael.mauch@gmx.de

Bug #17257 seems to be the same problem ("Digital UNIX OSF/1" is the
old name of "Compaq Tru64"). People there found that all sort functions
broke with PHP-4.2.0RC1, I can confirm this now.

Smallest test program:

<?php
$a = array(9,7,3,5);
sort($a);
print_r($a);
?>

Output:

Array
(
    [0] => 9
    [1] => 7
    [2] => 3
    [3] => 5
)

It's not compiler-related, both gcc-2.95.2 and Compac C V6.3-129 give
the same results. Maybe endianess-related (the Compaq machine have
Alpha processors)?

If somebody more clueful wants to take a look at this problem: Compaq
provides free test accounts (not only with Tru64, but also with
FreeBSD, NetBSD and Linux), see
<http://www.testdrive.compaq.com/>.

I compiled PHP-4.2.0RC1 there on FreeBSD/Alpha, and gcc-2.95.3 gives
lots of warnings:

***	The -O2 flag TRIGGERS KNOWN OPTIMIZER BUGS ON THIS PLATFORM

But even with CFLAGS="-O0 -g" sort() does not sort at all.

On FreeBSD/Intel it does work, so it probably is an endianess problem.

------------------------------------------------------------------------

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/17449

-- 
Edit this bug report at http://bugs.php.net/?id=17449&edit=1



Thread (21 messages)

« previous php.bugs (#9778) next »