Hello folks,

I am sure the subject line will make sure that next to no one reads
this message, but it is important for some of us.

Anyway, I finally got a pretty good lead what goes wrong when we
compute 1/y in a MV polynomial ring on Solaris using libSingular (1/x
also crashes, but that is not the point :).

I suspect the issue to be in coercion for the following reason:

Define a mv polynomial ring with say two indeterminates. Then

sage: 1/y

results in:

Program received signal SIGSEGV, Segmentation fault.
npPower (a=0x2, i=-74884, result=0x0) at modulop.cc:223
223     void npPower (number a, int i, number * result)
Current language:  auto; currently c++
(gdb) bt
#0  npPower (a=0x2, i=-74884, result=0x0) at modulop.cc:223
#1  0xfa178368 in npPower (a=0x2, i=-74884, result=0x0) at modulop.cc:
236
#2  0xfa178368 in npPower (a=Cannot access memory at address
0xff3ffde8
) at modulop.cc:236


As you can see we have number == 2 (second indeterminate), but the
power to be computed is *-74884*. Since npPower computes the power
recursively counting down to zero:

void npPower (number a, int i, number * result)
{
  if (i==0)
  {
    //npInit(1,result);
    *(long *)result = 1;
  }
  else if (i==1)
  {
    *result = a;
  }
  else
  {
    npPower(a,i-1,result); // <== line 236
    *result = npMultM(a,*result);
  }
}

For some reason in this case i is negative and I suspect that it isn't
-1 at the start. So it loops for a while until it smashes the stack.
Since the code works on all other platforms I suspect an issue in
coercion, but obviously I might be wrong. Since I know little about
the code in question I am hoping that somebody will just slap his/her
forehead and say "D'oh!". Anything that uses long, but expects to be
64 bits long on a 64 bit platform could also be a potential problem
since on Solaris in 32 bit mode you need to use long long. I fixed a
couple of those issues a while back in Sage's Z_p code and I suspect
that there is a similar bug in padics somehwere since the current code
loops endlessly, but that will be the subject of another email.

Thoughts?

Cheers,

Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to