www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1998/07/18/14:24:57

X-pop3-spooler: POP3MAIL 2.1.0 b 4 980420 -bs-
Date: Sat, 18 Jul 1998 20:21:57 +0300
Message-Id: <199807181721.UAA04532@localhost.localdomain>
To: pgcc-list AT Desk DOT nl
Mime-Version: 1.0
X-URL: http://www.goof.com/pcg/questions.html
X-Mailer: Lynx, Version 2.8rel.2
X-Personal_name: Aki Laukkanen
From: amlaukka AT cc DOT helsinki DOT fi
Subject: pgcc-19980707 bugs with bytemark
Sender: Marc Lehmann <pcg AT goof DOT com>
Status: RO
X-Status: A
Lines: 63

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019