Opened 5 years ago
Closed 5 years ago
#23545 closed defect (fixed)
Doctest: segmentation fault with coefficients() on symbolic expressions
Reported by:  Vincent Delecroix  Owned by:  

Priority:  major  Milestone:  sage8.2 
Component:  symbolics  Keywords:  bug, symbolics 
Cc:  Ralf Stephan  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  617a644 (Commits, GitHub, GitLab)  Commit:  617a644051487e59a300ba37254b0ec7743aff82 
Dependencies:  Stopgaps: 
Description (last modified by )
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 5 years ago by
Description:  modified (diff) 

comment:2 Changed 5 years ago by
Description:  modified (diff) 

comment:3 Changed 5 years ago by
Report Upstream:  N/A → 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 5 years ago by
Branch:  → u/rws/segmentation_fault_with_coefficients___on_symbolic_expressions 

comment:5 Changed 5 years ago by
Authors:  → Ralf Stephan 

Commit:  → 617a644051487e59a300ba37254b0ec7743aff82 
Dependencies:  → pynac0.7.10 
Report Upstream:  Reported upstream. Developers acknowledge bug. → Fixed upstream, in a later stable release. 
Pynac master has the fix. This branch adds doctests.
New commits:
617a644  23545: segmentation fault with coefficients() on symbolic expressions

comment:6 Changed 5 years ago by
Priority:  critical → major 

While the core dump is fixed in develop, one of the doctests fails.
comment:7 Changed 5 years ago by
Dependencies:  pynac0.7.10 

Report Upstream:  Fixed upstream, in a later stable release. → Not yet reported upstream; Will do shortly. 
comment:8 Changed 5 years ago by
Dependencies:  → #24262 

Report Upstream:  Not yet reported upstream; Will do shortly. → N/A 
comment:9 Changed 5 years ago by
comment:10 Changed 5 years ago by
comment:11 Changed 5 years ago by
Milestone:  sage8.1 → sage8.2 

Status:  new → needs_review 
Summary:  segmentation fault with coefficients() on symbolic expressions → Doctest: segmentation fault with coefficients() on symbolic expressions 
comment:12 Changed 5 years ago by
Reviewers:  → Travis Scrimshaw 

Status:  needs_review → positive_review 
LGTM.
comment:13 Changed 5 years ago by
Dependencies:  #24262 

comment:14 Changed 5 years ago by
Branch:  u/rws/segmentation_fault_with_coefficients___on_symbolic_expressions → 617a644051487e59a300ba37254b0ec7743aff82 

Resolution:  → fixed 
Status:  positive_review → closed 
Note: See
TracTickets for help on using
tickets.
Confirmed. I added a minimal case.