Skip to content

Native List.contains evaluates an overflowing predicate after the result is known #1728

Closed

Description

@oxura

The head already decides this search, but the native executable still evaluates the predicate on the next element and exits with a Nat past the largest immediate 2^48-1. The normalizing interpreter returns True{}.

import Base

def pred(n: Nat) -> Bool:
  Nat.is_le(Nat.add(n, 1n), 3n)

def main() -> Bool:
  List.contains(~Nat, ~(a => b => Nat.is_eq(Nat.mul(a, 65537n), b)), [0n, 4294967295n], 0n)

Built from main 0ab3f4e with bun bend2/main.ts repro.bend -o repro, then ran ./repro. It should return True{} without touching the tail predicate. This is the compiled-runtime side, not the neutral-tail proof issue fixed in #1616.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions