Bug?: (a^b).unit(a) -> SIGSEGV

Christian Bauer cbauer at student.physik.uni-mainz.de
Mon Dec 17 21:00:58 CET 2001


Hi!

On Sun, Nov 25, 2001 at 02:21:44PM +0200, Pearu Peterson wrote:
> Notice that (a^b).unit(a) leads to Segmentation fault. [...]
> Any ideas?

My guess is that it enters an infinite recursion in unit() because
lcoeff(a^b,a) = a^b, and unit() expects the coefficient to not contain
the specified variable any more.

Technically, unit() is being called with illegal arguments as it
expects a polynomial and doesn't do any checking for speed reasons.

Maybe power::degree() should throw an exception if it has a non-integer
exponent instead of returning 0? I'm not sure whether this will break
anything...

Bye,
Christian

-- 
  / Coding on PowerPC and proud of it
\/ http://www.uni-mainz.de/~bauec002/



More information about the GiNaC-devel mailing list