|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-06-10 14:35 UTC] php-bugs-2021 at ryandesign dot com
Description:
------------
php 7.3.? and later use asm goto in zend_operators.h if HAVE_ASM_GOTO is set in php_config.h. A problem arises if the compiler that was used to compile php supports asm goto but the compiler used to compile a separate php module (with phpize) does not support asm goto. The error message in that case is e.g.:
/opt/local/include/php73/php/Zend/zend_operators.h:523:10: error: expected '(' after 'asm'
__asm__ goto(
^
See https://trac.macports.org/ticket/62022 for the way that this affects php 7.3.x in MacPorts today, but note that as far as I know the potential for similar issues continues to exist in all later php versions too.
A previous bug report about this issue #75951 was closed as not a bug because of the difference in compilers. While perhaps you would prefer that all modules be compiled with the same compiler that was used to compile php, that cannot always be assured. For example, maybe a user compiles php, then changes their compiler (on macOS, maybe the user changes their Xcode version -- maybe it is updated for them automatically by Apple Software Update), then compiles a php module. Or maybe the choice of compiler is dictated by deficiencies in or requirements of a particular module (e.g. some require a C++11-capable compiler and some don't).
php modules compiled with phpize get their own configure scripts, so presumably it was already recognized that certain determinations must be made anew for each module. Would it be possible to move or copy the determination of whether the compiler supports asm goto into this phpize-generated configure script?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
I'm thinking something like this: diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index dad23bc4d8..a38b651ff8 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -500,7 +500,8 @@ ZEND_API void zend_update_current_locale(void); #define ZVAL_OFFSETOF_TYPE \ (offsetof(zval, u1.type_info) - offsetof(zval, value)) -#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer) +#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer) \ + && (!defined(__clang_major__) || __clang_major >= 9) # define ZEND_USE_ASM_ARITHMETIC 1 #else # define ZEND_USE_ASM_ARITHMETIC 0