[php-src] master: Fix GCC 15 -Walloc-size warnings in ext/ffi (#24344)

From: Date: Thu, 15 Oct 2026 19:00:16 +0000
Subject: [php-src] master: Fix GCC 15 -Walloc-size warnings in ext/ffi (#24344)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142337@lists.php.net to get a copy of this message
Author: Marc Bennewitz (marc-mabe) Committer: GitHub (web-flow) Pusher: ndossche Date: 2026-10-15T21:00:12+02:00 Commit: https://github.com/php/php-src/commit/0b4a5a8449261fd225abf0cca97323fbd459777c Raw diff: https://github.com/php/php-src/commit/0b4a5a8449261fd225abf0cca97323fbd459777c.diff Fix GCC 15 -Walloc-size warnings in ext/ffi (#24344) The trampoline fallbacks in zend_ffi_cdata_get_closure() and zend_ffi_get_func() deliberately allocate only a zend_internal_function but assign it to a zend_function pointer. GCC 15 reports this as "allocation of insufficient size", which breaks --enable-werror builds. Use the same uintptr_t cast as zend_get_property_hook_trampoline(). Changed paths: M ext/ffi/ffi.c Diff: diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 0f6e7626d834..3a3ef149a3f3 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -2163,7 +2163,7 @@ static zend_result zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry if (EXPECTED(EG(trampoline).common.function_name == NULL)) { func = &EG(trampoline); } else { - func = ecalloc(1, sizeof(zend_internal_function)); + func = (zend_function *)(uintptr_t)ecalloc(1, sizeof(zend_internal_function)); } func->type = ZEND_INTERNAL_FUNCTION; func->common.arg_flags[0] = 0; @@ -2943,7 +2943,7 @@ static zend_function *zend_ffi_get_func(zend_object **obj, zend_string *name, co if (EXPECTED(EG(trampoline).common.function_name == NULL)) { func = &EG(trampoline); } else { - func = ecalloc(1, sizeof(zend_internal_function)); + func = (zend_function *)(uintptr_t)ecalloc(1, sizeof(zend_internal_function)); } func->common.type = ZEND_INTERNAL_FUNCTION; func->common.arg_flags[0] = 0;

« previous php.cvs (#142337) next »