From 3350255c5083d89d45e74a0f1056552d97db5517 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 23 Jul 2024 18:23:24 +0300 Subject: [PATCH] Workaraound against false positive GCC array bounds error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents compilation error when compiling PHP by GCC with "-O2 -g -Wall -Werror" zend_API.c:2754:34: error: array subscript ‘zend_function {aka const union _zend_function}[0]’ is partly outside array bounds of ‘unsigned char[160]’ [-Werror=array-bounds=] 2754 | if (ZSTR_VAL(fptr->common.function_name)[0] != '_' --- Zend/zend_API.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 4c447845e5474..eb6e349f7ec21 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2559,8 +2559,8 @@ static void zend_check_magic_method_no_return_type( ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, zend_string *lcname, int error_type) /* {{{ */ { - if (ZSTR_VAL(fptr->common.function_name)[0] != '_' - || ZSTR_VAL(fptr->common.function_name)[1] != '_') { + if (ZSTR_VAL(lcname)[0] != '_' + || ZSTR_VAL(lcname)[1] != '_') { return; }