Opened 2 years ago

Closed 2 years ago

#23545 closed defect (fixed)

Doctest: segmentation fault with coefficients() on symbolic expressions

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-8.2
Component: symbolics Keywords: bug, symbolics
Cc: rws Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 617a644 (Commits) Commit: 617a644051487e59a300ba37254b0ec7743aff82
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

On sage 8.0

sage: (x^2/(1+x)).coefficients()
Segmentation fault (core dumped)

gdb shows that this is an infinite recursion in the Pynac library:

#0  GiNaC::add::integer_content (this=0x4095f00) at normal.cpp:95
#1  0x00007fff50051660 in GiNaC::ex::integer_content (this=this@entry=0x7fffff7ff410) at normal.cpp:81
#2  0x00007fff50076fdc in GiNaC::power::eval (this=0x7fffff800040, level=<optimized out>) at power.cpp:674
#3  0x00007fff4ff9b29e in GiNaC::ex::construct_from_basic (other=...) at ex.cpp:691
#4  0x00007fff50041ac3 in ex (other=..., this=0x7fffff800030) at ex.h:305
#5  GiNaC::mul::combine_ex_with_coeff_to_pair (this=0x40961a0, e=..., c=...) at mul.cpp:1228
#6  0x00007fff4ffa3084 in GiNaC::expairseq::evalchildren (this=this@entry=0x40961a0, level=1) at expairseq.cpp:1647
#7  0x00007fff50047390 in GiNaC::mul::eval (this=0x40961a0, level=<optimized out>) at mul.cpp:666
#8  0x00007fff4ff9b29e in GiNaC::ex::construct_from_basic (other=...) at ex.cpp:691
#9  0x00007fff50049ff6 in ex (other=..., this=0x7fffff800690) at ex.h:305
#10 GiNaC::mul::expand (this=0x4096030, options=0) at mul.cpp:1490
#11 0x00007fff4ff9ac0d in GiNaC::ex::expand (this=this@entry=0x7fffff800bf0, options=options@entry=0) at ex.cpp:84
#12 0x00007fff4ff9eec9 in expand (options=0, thisex=...) at ex.h:701
#13 GiNaC::match_monom (term=..., symb=..., vec=..., map=...) at ex.cpp:523
#14 0x00007fff4ff9f8c8 in GiNaC::ex::coefficients (this=this@entry=0x7fffff800e00, s=..., vec=...) at ex.cpp:576
#15 0x00007fff4ff9eed7 in GiNaC::match_monom (term=..., symb=..., vec=..., map=...) at ex.cpp:523
#16 0x00007fff4ff9f8c8 in GiNaC::ex::coefficients (this=this@entry=0x7fffff8011c0, s=..., vec=...) at ex.cpp:576
#17 0x00007fff4ff9eed7 in GiNaC::match_monom (term=..., symb=..., vec=..., map=...) at ex.cpp:523
#18 0x00007fff4ff9f8c8 in GiNaC::ex::coefficients (this=this@entry=0x7fffff801580, s=..., vec=...) at ex.cpp:576
#19 0x00007fff4ff9eed7 in GiNaC::match_monom (term=..., symb=..., vec=..., map=...) at ex.cpp:523
#20 0x00007fff4ff9f8c8 in GiNaC::ex::coefficients (this=this@entry=0x7fffff801940, s=..., vec=...) at ex.cpp:576
[...]

Change History (14)

comment:1 Changed 2 years ago by rws

  • Description modified (diff)

Confirmed. I added a minimal case.

comment:2 Changed 2 years ago by jdemeyer

  • Description modified (diff)

comment:3 Changed 2 years ago by rws

  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

The Pynac code does not check if the expression is a polynomial fraction in x. That case cannot be handled via coefficient() (the user should expand as a series). I will add a check to prevent this problem.

comment:4 Changed 2 years ago by rws

  • Branch set to u/rws/segmentation_fault_with_coefficients___on_symbolic_expressions

comment:5 Changed 2 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 617a644051487e59a300ba37254b0ec7743aff82
  • Dependencies set to pynac-0.7.10
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, in a later stable release.

Pynac master has the fix. This branch adds doctests.


New commits:

617a64423545: segmentation fault with coefficients() on symbolic expressions

comment:6 Changed 2 years ago by rws

  • Priority changed from critical to major

While the core dump is fixed in develop, one of the doctests fails.

comment:7 Changed 2 years ago by rws

  • Dependencies pynac-0.7.10 deleted
  • Report Upstream changed from Fixed upstream, in a later stable release. to Not yet reported upstream; Will do shortly.

comment:8 Changed 2 years ago by rws

  • Dependencies set to #24262
  • Report Upstream changed from Not yet reported upstream; Will do shortly. to N/A

comment:9 Changed 2 years ago by charpent

Fixed by #24262. I will give positive review if necessary, but as suggest to matk it duplicate and close it (after positive review of #24262, pf course...)..

comment:10 Changed 2 years ago by rws

#24147 has doctests for #23545 too so let's make #23545 the duplicate.

Version 1, edited 2 years ago by rws (previous) (next) (diff)

comment:11 Changed 2 years ago by rws

  • Milestone changed from sage-8.1 to sage-8.2
  • Status changed from new to needs_review
  • Summary changed from segmentation fault with coefficients() on symbolic expressions to Doctest: segmentation fault with coefficients() on symbolic expressions

comment:12 Changed 2 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:13 Changed 2 years ago by vbraun

  • Dependencies #24262 deleted

comment:14 Changed 2 years ago by vbraun

  • Branch changed from u/rws/segmentation_fault_with_coefficients___on_symbolic_expressions to 617a644051487e59a300ba37254b0ec7743aff82
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.