Skip to content

gr_nf and gr_fmpz_poly crash in WASM #319

Open

Description

@oscarbenjamin

In gh-318 the doctests for gr_nf and gr_fmpz_poly have to be commented out because the otherwise crash with:

RuntimeError: memory access out of bounds
    at wasm://wasm/020eeec2:wasm-function[9770]:0x4883e2
    at wasm://wasm/02dce51a:wasm-function[15598]:0x92739c
    at wasm://wasm/02dce51a:wasm-function[15582]:0x926e29
    at wasm://wasm/02dce51a:wasm-function[14735]:0x8d1694
    at wasm://wasm/02fbdcda:wasm-function[421]:0xc4097
    at wasm://wasm/020eeec2:wasm-function[2306]:0x1b8b1d
    at wasm://wasm/02fbdcda:wasm-function[684]:0xf209f
    at wasm://wasm/020eeec2:wasm-function[2306]:0x1b8b1d
    at wasm://wasm/020eeec2:wasm-function[1962]:0x1a0d0a
    at wasm://wasm/020eeec2:wasm-function[1949]:0x1a01c4 {
  pyodide_fatal_error: true
}

This was the only issue that did not get resolved in gh-262.

Activity

  1. oscarbenjamin commented on Sep 3, 2025

    @oscarbenjamin
    CollaboratorAuthor

    These are the doctests and they run fine in other situations but not in WASM:

    >>> from flint.types._gr import gr_nf_ctx
    >>> Qa = gr_nf_ctx.new([-2, 0, 1])
    >>> Qa
    gr_nf_ctx(x^2 + (-2))
    >>> Qa.modulus()
    x^2 + (-2)
    >>> a = Qa.gen()
    >>> a
    a
    >>> a**2
    2
    >>> (1 + a) ** 2
    2*a+3
    >>> (1 + a) / 2
    1/2*a+1/2

    >>> from flint.types._gr import gr_nf_fmpz_poly_ctx
    >>> Qa = gr_nf_fmpz_poly_ctx.new([-2, 0, 1])
    >>> Qa
    gr_nf_fmpz_poly_ctx(x^2 + (-2))
    >>> Qa.modulus()
    x^2 + (-2)
    >>> a = Qa.gen()
    >>> a
    a
    >>> a**2
    2
    >>> (1 + a) ** 2
    2*a+3

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