sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.39k stars 473 forks source link

NTL representation fails for padic high-valuation eisenstein-extension elements #29931

Open 333767a0-8bb0-4499-a032-33e52572d678 opened 4 years ago

333767a0-8bb0-4499-a032-33e52572d678 commented 4 years ago

Using version 9.1 of sage, the function _ntl_rep_abs(), implemented in: /sage/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx, crashes for some padic eisenstein-extension elements with high valuation.

This also causes sage to crash upon trying to coerce those elements into the appropriate integer-ring.

examples for elements on which _ntl_rep_abs() crashes:

sage: T.<a> = Qp(5).extension(x^2-5)
sage: Z = T.integer_ring()
sage: d = T(a^107 + O(a^200))
sage: d = T(a^107 + O(a^145))
sage: d = T(a^112 + O(a^200))

For each of the above elements, d._ntl_rep_abs() crashes, and therefore Z(d) (the coercion of d into the integer ring, which uses _ntl_rep_abs) also crashes.

Attached is a crash-log file for one of those cases.

On the contrary, the following are elements on which _ntl_rep_abs() and Z(d) do not crash:

sage: T.<a> = Qp(5).extension(x^2-5)
sage: Z = T.integer_ring()
sage: d = T(a + a^107 + O(a^200))
sage: d = T(a^107 + O(a^144))
sage: d = T(a^110 + O(a^200))

Looking into the code, it seems that the problematic line in _ntl_rep_abs is: "ans.x = dummy.unit". It seems that dummy.unit is somehow violated when executing the line "dummy._internal_lshift(self.ordp)", which in turn provokes execution of: "ZZ_pX_MulMod_pre(self.unit, self.unit, tmpP, mod[0])". From this point onward, dummy.unit seems to be violated - calling: dummy.unit_part() crashes (as it contains a line which is similar to the problematic one).

CC: @xcaruso

Component: padics

Keywords: NTL

Author: Noa Viner

Issue created by migration from https://trac.sagemath.org/ticket/29931

333767a0-8bb0-4499-a032-33e52572d678 commented 4 years ago

Attachment: ntl_crash_log.gz

mkoeppe commented 3 years ago
comment:2

Moving to 9.4, as 9.3 has been released.

fchapoton commented 2 years ago
comment:6

Still crashing in sage 9.7.rc0