public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix signed overflow for zext_hwi (..., 63)
@ 2014-05-02 15:37 Richard Sandiford
  2014-05-02 16:19 ` Mike Stump
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-05-02 15:37 UTC (permalink / raw)
  To: gcc-patches

...well, still HOST_BITS_PER_WIDE_INT-1 officially, until Richard's patches.

Caught by a boostrap-ubsan on wide-int.  Tested on x86_64-linux-gnu and
committed as obvious.

Richard


gcc/
	* hwint.h (zext_hwi): Fix signed overflow for prec == 63.

Index: gcc/hwint.h
===================================================================
--- gcc/hwint.h	2014-01-03 15:06:18.841058787 +0000
+++ gcc/hwint.h	2014-05-02 16:31:44.987263123 +0100
@@ -344,7 +344,7 @@ zext_hwi (unsigned HOST_WIDE_INT src, un
   else
     {
       gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT);
-      return src & (((HOST_WIDE_INT) 1 << prec) - 1);
+      return src & (((unsigned HOST_WIDE_INT) 1 << prec) - 1);
     }
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [committed] Fix signed overflow for zext_hwi (..., 63)
  2014-05-02 15:37 [committed] Fix signed overflow for zext_hwi (..., 63) Richard Sandiford
@ 2014-05-02 16:19 ` Mike Stump
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2014-05-02 16:19 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches

On May 2, 2014, at 8:36 AM, Richard Sandiford <rsandifo@linux.vnet.ibm.com> wrote:
> ...well, still HOST_BITS_PER_WIDE_INT-1 officially, until Richard's patches.
> 
> Caught by a boostrap-ubsan on wide-int.  Tested on x86_64-linux-gnu and
> committed as obvious.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-02 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-02 15:37 [committed] Fix signed overflow for zext_hwi (..., 63) Richard Sandiford
2014-05-02 16:19 ` Mike Stump

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).