#40683 [NEW]: zend_operators.h generates discard qualifier compiler warning

From: Date: Thu, 01 Mar 2007 19:44:25 +0000
Subject: #40683 [NEW]: zend_operators.h generates discard qualifier compiler warning
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109766@lists.php.net to get a copy of this message
From: lstefani at fortresstech dot com Operating system: linux 2.6.12-1.1381_FC3smp PHP version: 5.2.1 PHP Bug Type: Compile Warning Bug description: zend_operators.h generates discard qualifier compiler warning Description: ------------ Zend/zend_operators.h: In function `void* zend_memrchr(const void*, int, unsigned int)': Zend/zend_operators.h:250: warning: cast from const void*' to unsigned char*' discards qualifiers from pointer target type Zend/zend_operators.h:250: warning: cast from const void*' to unsigned char*' discards qualifiers from pointer target type In code snippet, line 250 refers to the two recasts of argument s. Reproduce code: --------------- static inline void *zend_memrchr(const void *s, int c, size_t n) { register unsigned char *e; if (n <= 0) { return NULL; } for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) { if (*e == (unsigned char)c) { return (void *)e; } } return NULL; } Expected result: ---------------- No compiler warnings. -- Edit bug report at http://bugs.php.net/?id=40683&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40683&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40683&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40683&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40683&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40683&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40683&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40683&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40683&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40683&r=support Expected behavior: http://bugs.php.net/fix.php?id=40683&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40683&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40683&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40683&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40683&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40683&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40683&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40683&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40683&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40683&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40683&r=mysqlcfg

« previous php.bugs (#109766) next »