Ticket #1053 (closed defect: fixed)
php_mapscript code produces warning: dereferencing type-punned pointer will break strict-aliasing rules
| Reported by: | dmorissette | Owned by: | mapserverbugs |
|---|---|---|---|
| Priority: | high | Milestone: | 4.4 release |
| Component: | MapScript-PHP | Version: | 4.3 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The following zend_hash_find call...
pval **phandle;
if (zend_hash_find(Z_OBJPROP_P(pThis), "_handle_",
sizeof("_handle_"),
(void **)&phandle) == SUCCESS)
... results in the following warning:
php_mapscript.c:11874: warning: dereferencing type-punned pointer will break
strict-aliasing rules
I have confirmed that the warning is caused by the (void **)&phandle cast when
using -O2 optimization with GCC 3.3.
It seems that using (void *)&phandle avoids the warning, I'm just not very clear
why.
The following thread from the PHP developers list discusses the issue and
suggests (void*) as an alternative as well:
http://www.zend.com/lists/php-dev/200308/msg00535.html
Change History
Note: See
TracTickets for help on using
tickets.
