public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <alan@SPRI.Levels.UniSA.Edu.Au>
To: Ian Lance Taylor <ian@zembu.com>
Cc: binutils@sourceware.cygnus.com
Subject: Overflow fix (was Problems with trampoline.S with 64 bit binutils)
Date: Wed, 28 Jul 1999 02:09:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.10.9907281829220.9976-100000@mullet.itr.unisa.edu.au> (raw)
In-Reply-To: <Pine.LNX.4.10.9907272027230.8678-100000@mullet.itr.unisa.edu.au>

Is it OK for me to check this one in, Ian?  It's almost in the "obvious
fix" category...

On Tue, 27 Jul 1999, I wrote:

> This is more elegant, and the concern voiced in the comment is no longer
> relevant as we check for size < sizof(valueT)
> 
> --- binutils-current/gas/write.c~	Fri Jul 16 17:57:19 1999
> +++ binutils-current/gas/write.c	Tue Jul 27 20:32:04 1999
> @@ -2733,24 +2733,13 @@
>  	{
>  	  if ((size_t) size < sizeof (valueT))
>  	    {
> -	      valueT mask, hibit;
> +	      valueT mask;
>  
> -	      /* set all bits to one */
>  	      mask = 0;
> -	      mask--;
> -	      /* Technically, combining these produces an undefined result
> -		 if size is sizeof (valueT), though I think these two
> -		 half-way operations should both be defined.  And the
> -		 compiler should be able to combine them if it's valid on
> -		 the host architecture.  */
> -	      mask <<= size * 4;
> -	      mask <<= size * 4;
> -	      hibit = (valueT) 1 << (size * 8 - 1);
> -	      if (((add_number & mask) != 0
> -		   || (fixP->fx_signed
> -		       && (add_number & hibit) != 0))
> -		  && ((add_number & mask) != mask
> -		      || (add_number & hibit) == 0))
> +	      mask--;	      /* set all bits to one */
> +	      mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
> +	      if ((add_number & mask) != 0
> +		  && (add_number & mask) != mask)
>  		{
>  		  char buf[50], buf2[50];
>  		  sprint_value (buf, fragP->fr_address + where);



       reply	other threads:[~1999-07-28  2:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.10.9907272027230.8678-100000@mullet.itr.unisa.edu.au>
1999-07-28  2:09 ` Alan Modra [this message]
1999-07-28 15:50   ` Ian Lance Taylor
1999-07-28 15:57     ` Alan Modra
1999-07-28 16:03       ` Ian Lance Taylor
1999-07-28 19:28     ` make check Alan Modra
1999-07-28 19:35       ` more "make check" issues Alan Modra
1999-08-03  9:43         ` Ian Lance Taylor
1999-07-29  9:38       ` make check Jason Merrill
1999-07-29 11:29       ` Ian Lance Taylor
1999-07-29 11:37         ` Ulrich Drepper
1999-07-29 17:22           ` Alan Modra

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=Pine.LNX.4.10.9907281829220.9976-100000@mullet.itr.unisa.edu.au \
    --to=alan@spri.levels.unisa.edu.au \
    --cc=binutils@sourceware.cygnus.com \
    --cc=ian@zembu.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).