From: Arnaud Le Blanc Date: Mon, 1 Jun 2009 15:08:00 +0000 (+0000) Subject: MFH: better fix for #48409 , #48428 , #48228 X-Git-Tag: php-5.2.10RC2~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=687f673bb964572b8568312177be411fa4c022fd;p=php MFH: better fix for #48409 , #48428 , #48228 --- diff --git a/Zend/zend.h b/Zend/zend.h index 8db545afe4..b169f265fd 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -178,6 +178,12 @@ char *alloca (); #endif +#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400 +#else +# define __restrict__ +#endif +#define restrict __restrict__ + #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN) # define do_alloca(p) alloca(p) # define free_alloca(p) diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index 10a9fd2b80..a689c39c5a 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -79,7 +79,7 @@ static inline void zend_ptr_stack_2_push(zend_ptr_stack *stack, void *a, void *b #undef ZEND_PTR_STACK_NUM_ARGS } -static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **b, void **c) +static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, zend_alias *restrict a, zend_alias *restrict b, zend_alias *restrict c) { *a = *(--stack->top_element); *b = *(--stack->top_element); @@ -87,7 +87,7 @@ static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void ** stack->top -= 3; } -static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b) +static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, zend_alias *restrict a, zend_alias *restrict b) { *a = *(--stack->top_element); *b = *(--stack->top_element); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 69fa16dc98..09c840a54c 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -36,6 +36,12 @@ typedef long zend_intptr_t; typedef unsigned long zend_uintptr_t; #endif +#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400 +typedef void* __attribute__((__may_alias__)) zend_alias; +#else +typedef void* zend_alias; +#endif + typedef unsigned int zend_object_handle; typedef struct _zend_object_handlers zend_object_handlers; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index b14914bbff..51878d275a 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2084,8 +2084,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) EG(This) = current_this; EG(scope) = current_scope; } - EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack)); - EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack)); + zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc)); zend_ptr_stack_clear_multiple(TSRMLS_C); @@ -3857,8 +3856,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } zval_ptr_dtor(&EX(object)); } - EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack)); - EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack)); + zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc)); } for (i=0; ilast_brk_cont; i++) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index febacef615..801e585486 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -302,8 +302,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS) EG(This) = current_this; EG(scope) = current_scope; } - EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack)); - EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack)); + zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc)); zend_ptr_stack_clear_multiple(TSRMLS_C); @@ -563,8 +562,7 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_ptr_dtor(&EX(object)); } - EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack)); - EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack)); + zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc)); } for (i=0; ilast_brk_cont; i++) {