Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend.h zend_ptr_stack.h zend_types.h zend_vm_def.h zend_vm_execute.h

[email protected] ("Nuno Lopes") Mon, 1 Jun 2009 22:08:06 +0100
Newsgroups php.zend-engine.cvs
Message-ID <AD547376220F434C8C8B80B49251501D@PC3EE1F19287>
Hi,

So I'm not particularly happy this solution. First it relies on gcc: the 
code is still broken for other compilers following C99 strict aliasing 
rules.
Second you're using may_alias and restrict at the same time, which have 
opposite meanings. They refer to different pointers, but it's still 
confusing.

As these functions are only called from 2 sites, I think fixing the function 
signature to the right types is the right solution.

Nuno


> lbarnaud Mon Jun  1 15:07:48 2009 UTC
>
>  Modified files:              (Branch: PHP_5_3)
>    /ZendEngine2 zend.h zend_ptr_stack.h zend_types.h zend_vm_def.h
>                zend_vm_execute.h
>  Log:
>  MFH: better fix for #48409 , #48428 , #48228
>
> +#define restrict __restrict__
> +typedef void* __attribute__((__may_alias__)) zend_alias;
>
> +static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, zend_alias 
> *restrict a, zend_alias *restrict b)