sympow seems to have presented some problems on Solaris 10 on x86. I've tried looking at this source code, and it makes little sense whatsoever to me.

William has tried to clean up the 'Configure' script, though it's still very messy, with things like

SH=`whichexe sh` && echo "#define SH \"$SH\"" >> $CONFIG
if [ -z "$SH" ]; then
  echo "**ERROR**: Could not find sh"; exit 1;
else
  echo "SH = $SH"
fi


Anyway, that aside, lets get to the C source code.

I tried to compile this with the Sun compiler, thinking that would help trace the problem. Well, it indicates a problem on line 68 of compute2.c

/bin/cc -O3   -c -o compute2.o compute2.c
"compute2.c", line 68: void function cannot return value

Looking at line a dozen or so lines either side of line 68, in the function pth_coeff_from_ap, we see:

void pth_coeff_from_ap(int W,llint p,int ap,int sp,QD x) /* p<2^50 */
{QD t={0.0,0.0,0.0,0.0},u={0.0,0.0,0.0,0.0},v={0.0,0.0,0.0,0.0}; int i;
 QD y={0.0,0.0,0.0,0.0},z={0.0,0.0,0.0,0.0}; int W2=2,W3=3,W4=4; QD ppow[16];
 if (W<4) {W4=W; if (W<3) {W3=W; if (W<2) W2=W;}}
 QD_copy(wmax,QD_zero,x); if ((HECKE) && (ap==0)) return;
 if (HECKE) return power_trace_from_ap(W,p,ap,sp,x); /*  LINE  68. !!!!!!!  */
 if (ap==0) {if (!(sp&1)) {t[0]=(double) (-p); QD_powi(W,t,sp/2,x);} return;}
 switch(sp)
 {case 1: x[0]=(double) ap; return;
  case 2: x[0]=(double) ap; x[0]=x[0]*x[0]-(double) p; return; /* a^2-p */
  case 3: y[0]=(double) ap; x[0]=y[0]*y[0]-(double) (2*p);
          QD_mul1(W2,x,y[0],x); return; /* a^3-2pa */

Se we can see that if(HECKE) this is supposed to return a value from power_trace_from_ap

But looking at power_trace_from_ap, we see it's declared as returning noting 
(void)

void power_trace_from_ap(int W,llint p,int ap,int sp,QD x) /* p<2^50 */
{QD t={0.0,0.0,0.0,0.0},u={0.0,0.0,0.0,0.0},v={0.0,0.0,0.0,0.0}; int i;
 QD y={0.0,0.0,0.0,0.0},z={0.0,0.0,0.0,0.0}; int W2=2,W3=3,W4=4; QD ppow[16];
 if (DEBUG) printf("power_trace_from_ap %lli %i %i\n",p,ap,sp);
 if (W<4) {W4=W; if (W<3) {W3=W; if (W<2) W2=W;}}
 QD_copy(wmax,QD_zero,x); if (sp==1) {x[0]=(double) ap; return;}
 y[0]=(double) ap; y[0]=y[0]*y[0];
 QD_copy(W4,QD_one,ppow[0]); QD_copy(W4,QD_zero,ppow[1]);


I don't know how gcc manages to compile this myself, but when it does not work, its hard to know what one is supposed to do when the code just looks wrong to me.

Likewise pth_coeff_from_ap is declared as void, but returns a value.


To me, this is just buggy gcc compiling code it should never compile. The fact the formatting of the code is a bit non-C like probably confuses gcc a bit.

Anyway, does anyone know how to sort this out, as I don't have a clue. It's simply not valid C, and I have no idea what the intension is either.

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to