This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
cast loss in final.c
- To: egcs at cygnus dot com
- Subject: cast loss in final.c
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Tue, 17 Mar 1998 00:35:15 +0000 (GMT)
I have just seen the apended change with cvs. I think it is wrong.
If the operand number cannot be represented as an integer on the host,
this can result in a negative value for c. By removing the cast to unsigned,
such an error condition will will not be checked for, but result in
a memory access to some peudo-random location.
Thu Mar 12 08:37:02 1998 Manfred Hollstein <manfred@s-direktnet.de>
...
* final.c (output_asm_insn): Don't cast insn_noperands to unsigned.
Index: final.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/final.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -p -r1.26 -r1.27
*** final.c 1998/03/11 07:12:25 1.26
--- final.c 1998/03/12 00:02:42 1.27
*************** output_asm_insn (template, operands)
*** 3244,3250 ****
if (! (*p >= '0' && *p <= '9'))
output_operand_lossage ("operand number missing after %-letter");
! else if (this_is_asm_operands && c >= (unsigned) insn_noperands)
output_operand_lossage ("operand number out of range");
else if (letter == 'l')
output_asm_label (operands[c]);
--- 3244,3250 ----
if (! (*p >= '0' && *p <= '9'))
output_operand_lossage ("operand number missing after %-letter");
! else if (this_is_asm_operands && c >= insn_noperands)
output_operand_lossage ("operand number out of range");
else if (letter == 'l')
output_asm_label (operands[c]);
*************** output_asm_insn (template, operands)
*** 3277,3283 ****
else if (*p >= '0' && *p <= '9')
{
c = atoi (p);
! if (this_is_asm_operands && c >= (unsigned) insn_noperands)
output_operand_lossage ("operand number out of range");
else
output_operand (operands[c], 0);
--- 3277,3283 ----
else if (*p >= '0' && *p <= '9')
{
c = atoi (p);
! if (this_is_asm_operands && c >= insn_noperands)
output_operand_lossage ("operand number out of range");
else
output_operand (operands[c], 0);