This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Fix for problem in recent reload.c changes


The recent reload mega-patch has introduced a small bug that causes
glibc-2.0.98 not to build for i586-linux.  The compiler generates an
illegal reload insn.  This is caused during a merge of two identical
reloads, both of which have address reloads.  The compiler gets confused
about which place it is going to reload from, and the place it ends up
reloading has had its address replacements deleted.

Stripped-down test case and patch appended.

Bernd


int sum = 0;

int a[10];
int b = 5;
int c;

int main ()
{
    int i,j,k,l,m,n,o,p;
    int t = b;

    for (i = 0; i < 10; i++)
	for (j = 0; j < 10; j++)
	    for (k = 0; k < 10; k++)
		for (l = 0; l < 10; l++)
		    for (m = 0; m < 10; m++)
			for (n = 0; n < 10; n++)
			    for (o = 0; o < 10; o++)
				for (p = 0; p < 10; p++)
				    sum += i + j + k + l + m + n + o + p;
    c = a[t] * a[t];
				    
}

	* reload.c (push_reload): When merging reloads, make sure
	that reload_in_reg and reload_in are from the same reload in
	all cases.

Index: reload.c
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/reload.c,v
retrieving revision 1.1.1.42
diff -u -p -r1.1.1.42 reload.c
--- reload.c	1998/10/22 11:02:39	1.1.1.42
+++ reload.c	1998/10/22 18:06:52
@@ -1320,6 +1320,7 @@ push_reload (in, out, inloc, outloc, cla
 	reload_outmode[i] = outmode;
       if (in != 0)
 	{
+	  rtx in_reg = inloc ? *inloc : 0;
 	  /* If we merge reloads for two distinct rtl expressions that
 	     are identical in content, there might be duplicate address
 	     reloads.  Remove the extra set now, so that if we later find
@@ -1333,12 +1334,13 @@ push_reload (in, out, inloc, outloc, cla
 		{
 		  remove_address_replacements (in);
 		  in = reload_in[i];
+		  in_reg = reload_in_reg[i];
 		}
 	      else
 		remove_address_replacements (reload_in[i]);
 	    }
 	  reload_in[i] = in;
-	  reload_in_reg[i] = inloc ? *inloc : 0;
+	  reload_in_reg[i] = in_reg;
 	}
       if (out != 0)
 	{



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]