On 2003-08-25 14:54:48, Ard Biesheuvel wrote:
> Casting to void* instead of void** cures the problem. As the cast

Yes, but why?

> I would consider it a justified change. I don't think there will be
> consequences for the validity of the optimization.

I don't know if with some optimizations void* or zval pointers need
special alignment.

> Code will have to be changed regardless, as it's not the function
> invocation but the cast itself that triggers the warning.

Yes, or we would be on the safe side if we compile with
-fno-strict-aliasing, then gcc doesn't do such expression based
optimizations. Or (as I have seen on some patches for other projects
after a search for the gcc warning message) we could change the zval**
data to something like this:

union {
  zval **zval;
  void *ptr;
} data;

call zend_hash_find(..., &data.ptr) and after this use
data.zval. Access via unions is allowed because then the data must be
correctly aligned for both types.

The gcc generated code for this variant only uses some other
registers, otherwise it seems similar.

  Stefan

-- 
Stefan Röhrich               [EMAIL PROTECTED], [EMAIL PROTECTED]
                                 http://www.roehri.ch/~sr/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to