Ask a Question related to PHP Bugs, Design and Development.
-
lstefani at fortresstech dot com #1
#40683 [NEW]: zend_operators.h generates discard qualifier compiler warning
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 [url]http://bugs.php.net/?id=40683&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40683&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40683&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40683&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40683&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=40683&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=40683&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40683&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=40683&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=40683&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=40683&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=40683&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=40683&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=40683&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40683&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=40683&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=40683&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40683&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=40683&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40683&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40683&r=mysqlcfg[/url]
lstefani at fortresstech dot com Guest
-
#36812 [Asn->Csd]: bind NULL variables generates warning
ID: 36812 Updated by: iliaa@php.net Reported By: ce at netage dot bg -Status: Assigned +Status: ... -
#36812 [Asn]: bind NULL variables generates warning
ID: 36812 Updated by: dave@php.net Reported By: ce at netage dot bg Status: Assigned Bug Type: ... -
Force Compiler Error/Warning Within Custom Control
I assume there's a way to do this since I've seen third-party components act the same way. How do I force the compiler to throw an error or... -
#36812 [Opn->Asn]: bind NULL variables generates warning
ID: 36812 Updated by: tony2001@php.net Reported By: ce at netage dot bg -Status: Open +Status: ... -
[PHP-DEV] [PATCH] Fix for 64-bit arch errors in zend_operators.c
--------------080104000508040900060706 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hello group, ... -
tony2001@php.net #2
#40683 [Opn->Fbk]: zend_operators.h generates discard qualifier compiler warning
ID: 40683
Updated by: [email]tony2001@php.net[/email]
Reported By: lstefani at fortresstech dot com
-Status: Open
+Status: Feedback
Bug Type: Compile Warning
Operating System: linux 2.6.12-1.1381_FC3smp
PHP Version: 5.2.1
New Comment:
What compiler do you use?
Previous Comments:
------------------------------------------------------------------------
[2007-03-01 19:44:25] lstefani at fortresstech dot com
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 this bug report at [url]http://bugs.php.net/?id=40683&edit=1[/url]
tony2001@php.net Guest
-
lstefani at fortresstech dot com #3
#40683 [NoF->Opn]: zend_operators.h generates discard qualifier compiler warning
ID: 40683
User updated by: lstefani at fortresstech dot com
Reported By: lstefani at fortresstech dot com
-Status: No Feedback
+Status: Open
Bug Type: Compile Warning
Operating System: linux 2.6.12-1.1381_FC3smp
PHP Version: 5.2.1
New Comment:
Sorry for the late response. Your email hit my company spam filter for
some reason. Just found it while going through the bulk mail folder.
To answer your question, I'm using the MIPS cross-compiler (GCC 3.3.2
and GLIBC 2.3.2) on Linux x86. I know that's not the latest GCC
compiler by a long shot, but just from reviewing the code, it does
appear that the const declaration is being discarded by recasting the
parameter as an unsigned char.
Previous Comments:
------------------------------------------------------------------------
[2007-03-09 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2007-03-01 19:59:07] [email]tony2001@php.net[/email]
What compiler do you use?
------------------------------------------------------------------------
[2007-03-01 19:44:25] lstefani at fortresstech dot com
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 this bug report at [url]http://bugs.php.net/?id=40683&edit=1[/url]
lstefani at fortresstech dot com Guest
-
tony2001@php.net #4
#40683 [Opn->WFx]: zend_operators.h generates discard qualifier compiler warning
ID: 40683
Updated by: [email]tony2001@php.net[/email]
Reported By: lstefani at fortresstech dot com
-Status: Open
+Status: Wont fix
Bug Type: Compile Warning
Operating System: linux 2.6.12-1.1381_FC3smp
PHP Version: 5.2.1
New Comment:
You can safely ignore it.
And no, I can't reproduce this warning with GCC4 & GCC3.4.6 or any
other compiler.
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 00:08:58] lstefani at fortresstech dot com
Sorry for the late response. Your email hit my company spam filter for
some reason. Just found it while going through the bulk mail folder.
To answer your question, I'm using the MIPS cross-compiler (GCC 3.3.2
and GLIBC 2.3.2) on Linux x86. I know that's not the latest GCC
compiler by a long shot, but just from reviewing the code, it does
appear that the const declaration is being discarded by recasting the
parameter as an unsigned char.
------------------------------------------------------------------------
[2007-03-09 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2007-03-01 19:59:07] [email]tony2001@php.net[/email]
What compiler do you use?
------------------------------------------------------------------------
[2007-03-01 19:44:25] lstefani at fortresstech dot com
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 this bug report at [url]http://bugs.php.net/?id=40683&edit=1[/url]
tony2001@php.net Guest



Reply With Quote

