From: Joern Rennecke <amylaar@cygnus.co.uk>
To: egcs@cygnus.com
Subject: cast loss in final.c
Date: Mon, 16 Mar 1998 20:44:00 -0000 [thread overview]
Message-ID: <199803170035.AAA09110@phal.cygnus.co.uk> (raw)
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);
reply other threads:[~1998-03-16 20:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199803170035.AAA09110@phal.cygnus.co.uk \
--to=amylaar@cygnus.co.uk \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).