php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32150 PHP fails to compile with gcc 4.0.0-alpha20050213 snapshot
Submitted: 2005-03-01 15:32 UTC Modified: 2005-04-23 01:37 UTC
Votes:6
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:2 (33.3%)
Same OS:0 (0.0%)
From: amd at store20 dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: php5-200503041530 OS: Gentoo GNU/Linux
Private report: No CVE-ID:
 [2005-03-01 15:32 UTC] amd at store20 dot com
Description:
------------
PHP fails to compile with Gcc-4.0.0 snapshot.



Reproduce code:
---------------
/bin/sh /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/openssl/ -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/ -DPHP_ATOM_INC -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/include -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/main -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3 -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/imap -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/mbstring/oniguruma -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/mbstring/libmbfl -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/usr/include/pspell  -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/TSRM  -O2 -mtune=pentium3  -prefer-pic -c /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c -o ext/openssl/openssl.lo
In file included from /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_API.h:27,
                 from /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/main/php.h:39,
                 from /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/libxml/libxml.c:29:
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:34: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:35: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:36: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:37: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:38: error: array type has incomplete element type
make: *** [ext/libxml/libxml.lo] Error 1
make: *** Waiting for unfinished jobs....
In file included from /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_API.h:27,
                 from /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/main/php.h:39,
                 from /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:28:
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:34: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:35: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:36: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:37: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_modules.h:38: error: array type has incomplete element type
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'add_assoc_name_entry':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:248: warning: pointer targets in passing argument 4 of 'add_assoc_stringl_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:251: warning: pointer targets in passing argument 4 of 'add_assoc_stringl_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'add_assoc_asn1_string':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:259: warning: pointer targets in passing argument 4 of 'add_assoc_stringl_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'asn1_time_to_time_t':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:282: warning: pointer targets in passing argument 1 of '_estrdup' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_x509_parse':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:917: warning: pointer targets in assignment differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'php_openssl_make_REQ':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:1236: warning: pointer targets in passing argument 3 of 'zend_hash_get_current_key_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:1236: warning: pointer targets in passing argument 4 of 'zend_hash_get_current_key_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:1310: warning: pointer targets in passing argument 3 of 'zend_hash_get_current_key_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:1310: warning: pointer targets in passing argument 4 of 'zend_hash_get_current_key_ex' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_pkey_export_to_file':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:1994: warning: pointer targets in passing argument 4 of 'PEM_write_bio_PrivateKey' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_pkey_export':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2045: warning: pointer targets in passing argument 4 of 'PEM_write_bio_PrivateKey' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_private_encrypt':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2594: warning: pointer targets in passing argument 2 of 'RSA_private_encrypt' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2603: warning: pointer targets in initialization differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_private_decrypt':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2652: warning: pointer targets in passing argument 2 of 'RSA_private_decrypt' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2668: warning: pointer targets in initialization differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_public_encrypt':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2717: warning: pointer targets in passing argument 2 of 'RSA_public_encrypt' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2727: warning: pointer targets in initialization differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_public_decrypt':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2776: warning: pointer targets in passing argument 2 of 'RSA_public_decrypt' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2794: warning: pointer targets in initialization differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_sign':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2876: warning: pointer targets in passing argument 3 of 'EVP_SignFinal' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2879: warning: pointer targets in initialization differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_verify':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2915: warning: pointer targets in passing argument 2 of 'EVP_VerifyFinal' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_seal':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2983: warning: pointer targets in passing argument 4 of 'EVP_EncryptUpdate' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:2995: warning: pointer targets in initialization differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c: In function 'zif_openssl_open':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:3059: warning: pointer targets in passing argument 3 of 'EVP_OpenInit' differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/openssl/openssl.c:3059: warning: pointer targets in passing argument 4 of 'EVP_DecryptUpdate' differ in signedness
make: *** [ext/openssl/openssl.lo] Error 1


Expected result:
----------------
Compile clean.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-01 15:46 UTC] amd at store20 dot com
Proposed fix:

--- Zend/zend_modules.h.orig    2005-03-01 16:33:58.000000000 +0200
+++ Zend/zend_modules.h 2005-03-01 16:44:48.000000000 +0200
@@ -23,6 +23,7 @@
 #define MODULES_H

 #include "zend.h"
+#include "zend_compile.h"

 #define INIT_FUNC_ARGS         int type, int module_number TSRMLS_DC
 #define INIT_FUNC_ARGS_PASSTHRU        type, module_number TSRMLS_CC
 [2005-03-01 16:38 UTC] amd at store20 dot com
Another catch:

/bin/sh /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/libtool --silent --preserve-dup-deps --mode=compile gcc -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc -DVERSION=0.50 -Iext/xmlrpc/ -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/ -DPHP_ATOM_INC -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/include -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/main -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3 -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/imap -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/mbstring/oniguruma -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/mbstring/libmbfl -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/usr/include/pspell  -I/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/TSRM  -O2 -mtune=pentium3  -prefer-pic -c /var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc/xml_element.c -o ext/xmlrpc/libxmlrpc/xml_element.lo
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc/xml_element.c: In function 'xml_elem_free_non_recurse':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc/xml_element.c:192: error: invalid lvalue in assignment
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc/xml_element.c: In function 'xml_elem_entity_escape':
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc/xml_element.c:317: warning: pointer targets in assignment differ in signedness
/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/ext/xmlrpc/libxmlrpc/xml_element.c:332: warning: pointer targets in assignment differ in signedness
make: *** [ext/xmlrpc/libxmlrpc/xml_element.lo] Error 1

Proposed fix:

decoder php-5.0.3 # for i in `ls -1 ext/xmlrpc/libxmlrpc/*.orig`; do diff -u $i ${i/\.orig/} ; done
--- ext/xmlrpc/libxmlrpc/simplestring.c.orig    2005-03-01 17:33:43.000000000 +0200
+++ ext/xmlrpc/libxmlrpc/simplestring.c 2005-03-01 17:33:47.000000000 +0200
@@ -85,7 +85,7 @@
 #include <string.h>
 #include "simplestring.h"

-#define my_free(thing)  if(thing) {free(thing); thing = 0;}
+#define my_free(thing)  if(thing) {free(thing); thing = NULL;}

 /*----------------------**
 * Begin String Functions *
--- ext/xmlrpc/libxmlrpc/xml_element.c.orig     2005-03-01 17:21:12.000000000 +0200
+++ ext/xmlrpc/libxmlrpc/xml_element.c  2005-03-01 17:35:20.000000000 +0200
@@ -189,7 +189,11 @@

       Q_Destroy(&root->children);
       Q_Destroy(&root->attrs);
-      my_free((char*)root->name);
+//      my_free((char*)root->name);
+      if (root->name) {
+             free((char *)root->name);
+             root->name = NULL;
+      }
       simplestring_free(&root->text);
       my_free(root);
    }
 [2005-03-01 16:49 UTC] amd at store20 dot com
After applying these two patches, it built fine.
 [2005-03-04 16:42 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

..and if (when) it fails, provide the patche(s) against to these source (CVS HEAD branch) and put them online somewhere where we can download them. The patches get messed up in this bug system..

 [2005-03-05 06:54 UTC] amd at store20 dot com
Used yesterday's CVS snapshot. One problem still existed (xmlrpc).
my_free is just a ugly wrapper to free.

http://amd.store20.com/files/2005-Q1/php5_xmlrpc_gcc4_compile_fix_bug_32150.patch
 [2005-04-23 01:37 UTC] jorton@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.

Oh, missed this one.  The my_free() problem was fixed this morning, using exactly the fix you proposed!
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Thu Aug 17 11:01:43 2017 UTC