Missing cast from unsigned char to int

Alexandre Oliva olivaATlsd.ic.unicamp.br
Tue Sep 14 00:20:00 GMT 1999


I was unable to complete stage1 on sparc-sun-solaris2.5 using an old
Sun SPARCompiler.  It would crash with an ICE while building _eh from
libgcc.

The problem was that scan_one_insn compared:

904:  for (i = 0; i < recog_data.n_operands - 1; i++)
                       (unsigned char)

and it seems that cc performed promotion after after subtraction,
entering the loop when recog_data.n_operands was 0.  It ended up
crashing in the next line:

905:    if (constraints[i][0] == '%')

since constraints[i], when i==4, pointed to garbage.

The following patch adds casts to int, fixing this particular problem,
in hunk 4, and a similarly suspect construction, in hunk 2, and
silencing warnings cc emitted about the lack of such casts, in the
other hunks.



More information about the Gcc-patches mailing list