[6476] in Athena Bugs

home help back first fref pref prev next nref lref last post

likely rt compiler bug... (2.1y)

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Wed Nov 28 03:22:34 1990

Date: Wed, 28 Nov 90 03:22:19 -0500
From: Ken Raeburn <Raeburn@MIT.Edu>
To: bugs@ATHENA.MIT.EDU

If I'm reading it right, the assembly output from the following code,
when compiled without optimization, is incorrect.  Optimizing "fixes"
the problem.

#include <stdio.h>
#include <math.h>
#define  sqr(x)  ((x)*(x))

void icd(n, nx, a, l)
   int n, nx; 
   double **a, **l;
{
    int i;
    double liisq;
    for (i=0; i<n; i++) {
	liisq= a[0][i];
	if (i    > 0) liisq -= sqr(l[1][i-1]);
	if (i-nx >=0) liisq -= sqr(l[2][i-nx]);
	printf("before line\n");
	l[0][i] = sqrt(liisq);
	printf("line passed\n");
	l[1][i] = a[1][i]/l[0][i];
	l[2][i] = a[2][i]/l[0][i];  
    }
}

The code storing the result of `sqrt' is:

	balix	r15,_.sqrt
	l	r0,LF2-_icd(r14)
	ls	r0,0(r13)	# get l[0]
	cas	r4,r0,r11	# get an address
	mr	r11,r12		# *now* compute the offset needed
	shl	r11,3		#   for the above address calculation?
	sts	r2,0(r4)	# store...
	sts	r3,4(r4)

No other instructions in this function set r11.

This came from an OLC user this evening....

home help back first fref pref prev next nref lref last post