Skip to content

Integer overflow wraps instead of promoting to float #48

Closed

Description

@blacktrs

Summary

Integer overflow wraps instead of promoting to float.

Also listed in the docs/ROADMAP.md Tier 1 gap matrix.

Repro

<?php
$a = PHP_INT_MAX;
var_dump($a + 1, $a * 2);

Expected (php 8.5)

float(9.223372036854776E+18)
float(1.8446744073709552E+19)

Actual (manticore 10affa68, macOS arm64)

int(-9223372036854775808)
int(-2)

Tracking

Known-bug repro: tests/aot/repro/wrong/int_overflow.php — bash tests/aot/xfail.sh -k int_overflow reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 5, 2026
  2. added
    needs-design
    area:types
    on Oct 13, 2026
  3. blacktrs commented on Oct 13, 2026

    @blacktrs
    ContributorAuthor

    Scope: needs value-range analysis (VRA). Int overflow wraps because statically-int values have no range info; promoting to float on overflow needs VRA or checked arithmetic with a float fallback (perf cost). See also: user rule that narrowing out of range is an explicit error. Parked branch: vra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:typesbugneeds-designwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions