#32797 [Csd]: Compile fails with xml_element.c: my_free using gcc 4

From: Date: Fri, 22 Apr 2005 15:53:25 +0000
Subject: #32797 [Csd]: Compile fails with xml_element.c: my_free using gcc 4
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78067@lists.php.net to get a copy of this message
ID: 32797 User updated by: JClawson at tamu dot edu Reported By: JClawson at tamu dot edu Status: Closed Bug Type: Compile Failure Operating System: * (with GCC 4 only) PHP Version: 5.0.4 New Comment: GREAT! Thanks! Previous Comments: ------------------------------------------------------------------------ [2005-04-22 13:12:32] 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. This is invalid C code; allowing cast-as-lvalue is an extension to C which has been deprecated (and has triggered warnings) since gcc 3.4. Fixed on HEAD, will backport shortly. ------------------------------------------------------------------------ [2005-04-22 09:14:41] sniper@php.net Not everyone will use GCC..ever. ------------------------------------------------------------------------ [2005-04-22 08:14:33] JClawson at tamu dot edu Hmmm... I thought free was supposed to ignore the null pointer. At least that was my understanding: Here is a nice table: http://developer.apple.com/qa/qa2001/qa1259.html I guess its better to be safe than sorry. ------------------------------------------------------------------------ [2005-04-22 07:24:46] abies@php.net 1) Relying on free() to ignore NULL pointers is not portable: we do have to support other compilers beside GCC 4 2) Using cast expressions as lvalues has always been supported in C, but apparently GCC 4 suddenly doesn't support it anymore. In this particular case, however, we might change the macro so it only does the cast for the argument to free() , and only for compilers that require it, i.e. compilers/libc's that define free like free(char*) ------------------------------------------------------------------------ [2005-04-22 04:44:12] wez@php.net Please lose the attitude; we don't have time for that. As for PHP; you appear to have the knowledge--submit a working patch that doesn't break the code. ------------------------------------------------------------------------ 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/32797 -- Edit this bug report at http://bugs.php.net/?id=32797&edit=1

« previous php.bugs (#78067) next »