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]

Re: Bootstrap ICE on alpha-osf4 building stage1 libgcc.a


On Jan 24, 2000, Richard Henderson <rth@cygnus.com> wrote:

> This should work though, and it'd be nice to verify that it does
> before I go in and force the old behaviour.

Nope, the problem is stack corruption, at least in case of
FLOAT_TRUNCATE.  The incoming operands array is just two-entries
long, so you can't assign to operands[2].

Here's a patch that fixes this problem.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* config/alpha/alpha.c (alpha_emit_xfloating_cvt): Do not assume
	incoming operands array is large enough for one more operand.
	
Index: gcc/config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.c,v
retrieving revision 1.111
diff -u -r1.111 alpha.c
--- gcc/config/alpha/alpha.c	2000/01/25 10:38:41	1.111
+++ gcc/config/alpha/alpha.c	2000/01/26 06:53:39
@@ -1978,6 +1978,7 @@
      rtx operands[];
 {
   int noperands = 1, mode;
+  rtx out_operands[2];
   const char *func;
 
   func = alpha_lookup_xfloating_lib_func (code);
@@ -1986,19 +1987,22 @@
     {
     case FIX:
       mode = alpha_compute_xfloating_mode_arg (code, ALPHA_FPRM_CHOP);
-      operands[2] = GEN_INT (mode);
       noperands = 2;
+      out_operands[1] = GEN_INT (mode);
+      out_operands[0] = operands[1];
       break;
     case FLOAT_TRUNCATE:
       mode = alpha_compute_xfloating_mode_arg (code, alpha_fprm);
-      operands[2] = GEN_INT (mode);
       noperands = 2;
+      out_operands[1] = GEN_INT (mode);
+      out_operands[0] = operands[1];
       break;
     default:
+      out_operands[0] = operands[1];
       break;
     }
 
-  alpha_emit_xfloating_libcall (func, operands[0], operands+1, noperands,
+  alpha_emit_xfloating_libcall (func, operands[0], out_operands, noperands,
 				gen_rtx_fmt_e (code, GET_MODE (operands[0]),
 					       operands[1]));
 }

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

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