Ask Your Question

Revision history [back]

If F is a finite field implemented via Givaro, multivariate polynomials over F seem very fragile.

Below is a simpler reproducer for the bug.

The bug disappears when removing impl='givaro'.

It also disappears when using f = a instead of f = -a.

sage: p = 3
sage: F = GF(p, impl='givaro')
sage: R.<a, b> = F[]
sage: f = -a
sage: f.dict()
------------------------------------------------------------------------
(no backtrace available)
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
.../src/bin/sage-python: line 2: 22824 Segmentation fault: 11  sage -python "$@"

If F is a finite field implemented via Givaro, multivariate Multivariate polynomials over F Givaro finite fields seem very fragile.

Below is are a few simpler reproducer reproducers for the bug.

The bug disappears when removing crash.

It seems the crash

  • does not occur without impl='givaro'.

    It also disappears when using f = a instead

  • does not seem to depend on the value of f = -a.an odd prime p (I tried 3, 31, 229)

Common preamble in long form:

sage: p = 3
sage: F = GF(p, impl='givaro')
sage: R.<a, b> = F[]
sage: f = 

or in short form:

sage: R.<a, b> = GF(3, impl='givaro')[]

Define a few polynomials (g and h are the same when p = 3):

sage: f, g, h = a, 2*a, -a

Then f behaves well but g and h don't.

Multivariate polynomials over Givaro finite fields seem very fragile.

Below are a few simpler reproducers for the crash.

It seems the crash

  • does not occur without impl='givaro'.
  • does not seem to depend on the value of an odd prime p (I tried 3, 31, 229)

Common preamble in long form:

sage: p = 3
sage: F = GF(p, impl='givaro')
sage: R.<a, b> = F[]

or in short form:

sage: R.<a, b> = GF(3, impl='givaro')[]

Define a few polynomials (g and h are the same when p = 3):

sage: f, g, h = a, 2*a, -a

Then f behaves well but g and h don't.

These commands work:

sage: f.dict()
{(1, 0): 1}

sage: f[a]
a

These commands work:

sage: f.dict()
{(1, 0): 1}

sage: f[a]
a

sage: f[b], g[b], h[b]
(0, 0, 0)

But the following commands crash:

sage: g.dict()
<CRASH>

sage: g[a]
<CRASH>

sage: h.dict()
<CRASH>

sage: h[a]
<CRASH>

Where <CRASH> is:

------------------------------------------------------------------------
(no backtrace available)
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
.../src/bin/sage-python: line 2: 22824 ... Segmentation fault: 11  sage -python "$@"

The fragility seems connected to scalars other than 0 and 1.

Not sure if this is related: the finite field list is ordered differently in the Givaro implementation:

sage: GF(3).list()
[0, 1, 2]

sage: GF(3, impl='givaro').list()
[0, 2, 1]

Multivariate polynomials over Givaro finite fields seem very fragile.

Below are a few simpler reproducers for the crash.

Their dict and __getitem__ methods crash easily. It seems the crash

  • occurs for any odd prime p (tried 3, 31, 229)
  • does not occur without impl='givaro'.
  • does not seem to depend on the value of an odd prime p (I tried 3, 31, 229)

Common preamble in long form:

sage: p = 3
sage: F = GF(p, impl='givaro')
sage: R.<a, b> = F[]

or in short form:Here are a few simple reproducers for the crash, with Sage 9.2.beta13.

sage: R.<a, b> = GF(3, impl='givaro')[]

Define a few polynomials (g and h are the same when p = 3):

sage: f, g, h = a, 2*a, -a

Then f behaves well but g and h don't.

Multivariate polynomials over Givaro finite fields seem very fragile.

Below are a few simpler reproducers for the crash.

It seems the crash

  • does not occur without impl='givaro'.
  • does not seem to depend on the value of an odd prime p (I tried 3, 31, 229)

Common preamble in long form:

sage: p = 3
sage: F = GF(p, impl='givaro')
sage: R.<a, b> = F[]

or in short form:

sage: R.<a, b> = GF(3, impl='givaro')[]

Define a few polynomials (g and h are the same when p = 3):

sage: f, g, h = a, 2*a, -a

Then f behaves well but g and h don't.

These commands work:

sage: f.dict()
{(1, 0): 1}

sage: f[a]
a

These commands work:

sage: f.dict()
{(1, 0): 1}

sage: f[a]
a

sage: f[b], g[b], h[b]
(0, 0, 0)

But the following commands crash:

 sage: g.dict()
<CRASH>

sage: g[a]
<CRASH>

sage: h.dict()
<CRASH>

sage: h[a]
<CRASH>

Where where <CRASH> is:

------------------------------------------------------------------------
(no backtrace available)
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
.../src/bin/sage-python: .../bin/sage-python: line 2: ... Segmentation fault: 11  ... sage -python "$@"

By contrast, these commands work:

sage: f.dict()
{(1, 0): 1}

sage: f[a]
a

sage: f[b], g[b], h[b]
(0, 0, 0)

The fragility crash thus seems connected to scalars other than 0 and 1.

Not sure if this is related: the finite field list is ordered differently in the Givaro implementation:

sage: GF(3).list()
[0, 1, 2]

sage: GF(3, impl='givaro').list()
[0, 2, 1]