Skip to content

Commit a630057

Browse files
committed
Fix -Wint-to-pointer-cast warnings in the CALL VM on 32-bit
ZEND_VM_ENTER_BIT tags the opline returned by CALL VM handlers. It is 1ULL so that ~ZEND_VM_ENTER_BIT keeps the upper half of 64-bit pointers, but on 32-bit platforms it widens the tagged pointer expressions to 64 bits, and casting those back to a pointer warns. This breaks --enable-werror builds where no global VM registers are used, e.g. arm32, or i386 with --disable-gcc-global-regs, which also hits the copy of the definition in the JIT. Use (uintptr_t)1 instead, which is exactly pointer-sized everywhere.
1 parent 688d0fe commit a630057

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Zend/zend_vm_execute.h‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Zend/zend_vm_gen.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
20352035
out($f,"# define ZEND_VM_ENTER() opline = EG(current_execute_data)->opline; ZEND_VM_ENTER_EX()\n");
20362036
out($f,"# define ZEND_VM_LEAVE() return 2\n");
20372037
out($f,"#else\n");
2038-
out($f,"# define ZEND_VM_ENTER_BIT 1ULL\n");
2038+
out($f,"# define ZEND_VM_ENTER_BIT ((uintptr_t)1)\n");
20392039
out($f,"# define ZEND_VM_ENTER_EX() return (zend_op*)((uintptr_t)opline | ZEND_VM_ENTER_BIT)\n");
20402040
out($f,"# define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_ENTER_EX()\n");
20412041
out($f,"# define ZEND_VM_LEAVE() return (zend_op*)((uintptr_t)opline | ZEND_VM_ENTER_BIT)\n");

‎ext/opcache/jit/zend_jit_internal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ extern const zend_op *zend_jit_interrupt_op;
222222
# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU EXECUTE_DATA_C OPLINE_CC
223223
# define ZEND_OPCODE_HANDLER_ARGS_EX EXECUTE_DATA_D OPLINE_DC,
224224
# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_EX EXECUTE_DATA_C OPLINE_CC,
225-
# define ZEND_VM_ENTER_BIT 1ULL
225+
# define ZEND_VM_ENTER_BIT ((uintptr_t)1)
226226
#endif
227227

228228
/* VM helpers */

0 commit comments

Comments
 (0)