Hi, On 28.01.2018 19:35, Alexey Sheplyakov wrote:
27.01.2018, 02:42, "Vitaly Magerya" <vmagerya@gmail.com>:
These segfaults have this sort of backtrace:
#1 0x00007ffff7a07f79 in GiNaC::ex::construct_from_basic(...) #2 0x00007ffff79e19e2 in GiNaC::basic::subs_one_level(...) const #3 0x00007ffff7b3d235 in GiNaC::power::subs(...) const #4 0x00007ffff7a0ba11 in GiNaC::expairseq::subschildren(...) const #5 0x00007ffff7a0bd64 in GiNaC::expairseq::subs(...) const #6 0x00007ffff7a08d4e in GiNaC::ex::subs(...) const #7 0x00007ffff7aeb6c0 in GiNaC::gcd(...) #8 0x00007ffff7aea806 in GiNaC::gcd_pf_pow(...) #9 0x00007ffff7aebbd0 in GiNaC::gcd(...) #10 0x00007ffff7aeac26 in GiNaC::gcd_pf_pow(...) #11 0x00007ffff7aebbd0 in GiNaC::gcd(...)
(repeat the last two lines a whole bunch of times)
#20147 0x00007ffff7aebbd0 in GiNaC::gcd(...) #20148 0x00007ffff7aeac26 in GiNaC::gcd_pf_pow(...) #20149 0x00007ffff7aea2f8 in GiNaC::gcd_pf_pow(...) Looks like gcd() goes to an infinite recursion. Could you please make a breakpoint in GiNaC::gcd_pf_pow and print expressions which cause this misbehavior?
Well, it's not an infinite recursion. But computations like gcd(expand(x^1000*(1+x)^2),x^1000) cause GiNaC to recurse so deeply that it eventually overflows the stack. Also, they take way too long. They appear a lot in Vitaly's example. This goofy recursion ought to be shortcut, somehow. -richy.