bug81225.phpt 592 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #81225: Wrong result with pow operator with JIT enabled
  3. --EXTENSIONS--
  4. opcache
  5. --INI--
  6. opcache.enable=1
  7. opcache.enable_cli=1
  8. opcache.jit_buffer_size=1M
  9. opcache.jit=tracing
  10. --SKIPIF--
  11. <?php if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?>
  12. --FILE--
  13. <?php
  14. function unsignedLong(int $offset): int
  15. {
  16. $normalizedOffset = $offset % (2 ** 32);
  17. if ($normalizedOffset < 0) {
  18. $normalizedOffset += 2 ** 32;
  19. }
  20. return $normalizedOffset;
  21. }
  22. $offset = -0x100000000 + 2;
  23. for ($i = 0; $i < 200; ++$i) {
  24. assert(unsignedLong($offset) === 2);
  25. }
  26. ?>
  27. OK
  28. --EXPECT--
  29. OK