php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31358 Compile time error, incompatible types in assignment in zend.c on PPC
Submitted: 2004-12-30 22:03 UTC Modified: 2005-06-28 00:06 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: hawk at pld-linux dot org Assigned: sniper (profile)
Status: Closed Package: Compile Failure
PHP Version: 5CVS, 4CVS (2005-06-19) OS: * (old gcc, 2.95.x)
Private report: No CVE-ID: None
 [2004-12-30 22:03 UTC] hawk at pld-linux dot org
Description:
------------
The compilation of PHP 4.3.10 fails on Linux running on PowerPC with following error:

/home/users/builder/rpm/BUILD/php-4.3.10/Zend/zend.c -o Zend/zend.lo 
/home/users/builder/rpm/BUILD/php-4.3.10/Zend/zend.c: In function `zend_error':
/home/users/builder/rpm/BUILD/php-4.3.10/Zend/zend.c:776: incompatible types in assignment
make: *** [Zend/zend.lo] Error 1

Following code change is reponsible for this bug:
cvs diff -u -r 1.162.2.21 -r 1.162.2.22 Zend/zend.c

Line 776 is:
usr_copy = args;
where both usr_copy and args are of type va_list. Such code will not compile on Linux on PowerPC (and probably on some other architectures too) because va_list is struct here.

I know only two ways for fixing it. One is to use va_copy, but I'm not sure if its safe to change following portion of code:

#if defined(va_copy)
                       va_copy(usr_copy, args);
#else
                       usr_copy = args;
#endif

just into:

va_copy(usr_copy, args);

Probably its not safe. The second way is to use
usr_copy[0] = args[0];
for the affected architectures, but its not safe either AFAIR.

I also suppose that php 5.0.3 is affected too, because it contains same code


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-31 19:46 UTC] hawk at pld-linux dot org
The bug affects only PPC systems with older GCC which don't support va_copy (sorry, didn't noticed this earlier), the workaround is to change line 776 of zend.c:
usr_copy = args;
into
memcpy(usr_copy, args, sizeof(va_list));
for these architectures. It seems to work perfectly
 [2005-01-02 08:58 UTC] stas@php.net
Which GCC do you have? It is rather strange va_copy is not defined on Linux. Do you have stdarg.h anywhere?
 [2005-01-04 14:35 UTC] hawk at pld-linux dot org
According to 'gcc -v':
Reading specs from /usr/lib/gcc-lib/ppc-pld-linux/2.95.4/specs
gcc version 2.95.4 20010319 (prerelease)

And yes, there is stdarg.h in
/usr/lib/gcc-lib/ppc-pld-linux/2.95.4/include/stdarg.h
 [2005-01-04 16:02 UTC] jorton@php.net
va_copy is a C99 invention, so that's why it's not in gcc-2.95.2 (though some older gcc's had a __va_copy). But even in C99 va_copy is explicitly allowed to be a function not a macro, I can't see any guarantee that it is defined for the preprocessor as this code assumes. (C99/7.15.1)
 [2005-02-07 10:14 UTC] stas@php.net
I guess we need some autoconf-magic experts to make an autoconf resolve these differences and try to find the right va_copy. 
 [2005-06-18 23:44 UTC] sniper@php.net
Try this patch please:
http://www.php.net/~jani/patches/bug31358.patch

 [2005-06-28 00:06 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC