Mail Archives: pgcc/1998/07/18/14:24:57
Hello,
First of all I'm not on the mailing list so please could you respond
privately also? (How about making mailing list archives available
somewhere?)
Used the 19980707 snapshot to compile the bytemark benchmark (available from
http://www.byte.com/). Resulted executable worked fine until LU
decomposition test where it segment faulted in function build_problem()
which is in file nbench1.c. The offending piece of code:
static void build_problem(double a[][LUARRAYCOLS], int n,
double b[LUARRAYROWS])
long i,j,k,k1; /* Indexes */
double rcon; /* Random constant */
/* ... */
for(i = 0; i < 8*n; i++)
{
k = abs_randwc((long)n);
k1= abs_randwc((long)n);
if(k != k1)
{
if(k < k1) rcon=(double)1.0;M
else rcon=(double)-1.0;
for(j = 0; j < n; j++)
a[k][j] += a[k1][j] * rcon;
b[k] += b[k1] * rcon;
}
}
}
I omitted comments, unrelated codee and did some editing so it doesn't look
quite so messy as in the sources. The assignment:
a[k][j] += ...
fails during he first iteration of the loop (j = 0). Let's look at the
generated code (gcc -O6 -ffast-math -fno-unroll-loops):
3ad1: 8b 7c 24 20 movl 0x20(%esp,1),%edi
3ad5: 43 incl %ebx
3ad6: dd 04 17 fldl (%edi,%edx,1)
3ad9: d8 c9 fmul %st(1),%st
3adb: 83 c2 08 addl $0x8,%edx
3ade: dc 04 07 faddl (%edi,%eax,1)
3ae1: 83 c0 08 addl $0x8,%eax
3ae4: dd 58 f8 fstpl 0xfffffff8(%eax)
^--- segment fault here
3ae7: 8b 4c 24 24 movl 0x24(%esp,1),%ecx
3aeb: 39 cb cmpl %ecx,%ebx
3aed: 7c e2 jl 3ad1 <build_problem+0x144>
Although I'm no x86 assembly guru it seems that this is clearly wrong and
when I replaced the fstpl line with:
fstpl -8(%edi,%eax)
it did go through that loop only to segment fault a bit later in another
function (I didn't check why). The problem went away when compiling with
-O1. Also tested with egcs 1.03a which worked just fine.
Second problem, tried to compile pgcc-19980715 snapshot but it failed in
gcc/combine.c but I'm sure you already know about that. Is there a patch for
that?
- Raw text -