This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bootstrap ICE on alpha-osf4 building stage1 libgcc.a
On Jan 26, 2000, Richard Henderson <rth@cygnus.com> wrote:
> On Wed, Jan 26, 2000 at 05:00:26AM -0200, Alexandre Oliva wrote:
>> 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].
> Ug. How dumb.
>> default:
>> + out_operands[0] = operands[1];
> Pull this up out of the switch so there's only one such assignment.
BTW, are ` case : ... if(0) { case : ... } ...' tricks acceptable? We
could have a single assignment to out_operands[0] too, like this:
switch (code)
{
case FIX:
mode = alpha_compute_xfloating_mode_arg (code, ALPHA_FPRM_CHOP);
if (0)
{
case FLOAT_TRUNCATE:
mode = alpha_compute_xfloating_mode_arg (code, alpha_fprm);
}
out_operands[1] = GEN_INT (mode);
noperands = 2;
break;
> Same bug in alpha_emit_xfloating_arith too.
Thanks. Here's a revised patch (without the dirty trick above :-)
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.
(alpha_emit_xfloating_arith): Likewise.
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 07:21:53
@@ -1936,12 +1936,15 @@
{
const char *func;
int mode;
+ rtx out_operands[3];
func = alpha_lookup_xfloating_lib_func (code);
mode = alpha_compute_xfloating_mode_arg (code, alpha_fprm);
- operands[3] = GEN_INT (mode);
- alpha_emit_xfloating_libcall (func, operands[0], operands+1, 3,
+ out_operands[0] = operands[1];
+ out_operands[1] = operands[2];
+ out_operands[2] = GEN_INT (mode);
+ alpha_emit_xfloating_libcall (func, operands[0], out_operands, 3,
gen_rtx_fmt_ee (code, TFmode, operands[1],
operands[2]));
}
@@ -1978,27 +1981,30 @@
rtx operands[];
{
int noperands = 1, mode;
+ rtx out_operands[2];
const char *func;
func = alpha_lookup_xfloating_lib_func (code);
+ out_operands[0] = operands[1];
+
switch (code)
{
case FIX:
mode = alpha_compute_xfloating_mode_arg (code, ALPHA_FPRM_CHOP);
- operands[2] = GEN_INT (mode);
+ out_operands[1] = GEN_INT (mode);
noperands = 2;
break;
case FLOAT_TRUNCATE:
mode = alpha_compute_xfloating_mode_arg (code, alpha_fprm);
- operands[2] = GEN_INT (mode);
+ out_operands[1] = GEN_INT (mode);
noperands = 2;
break;
default:
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