This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Another undef behavior fix


On March 26, 2014 4:57:28 PM CET, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>Doing low = -low; on signed HOST_WIDE_INT results in undefined behavior
>if the low HWI is LONG_LONG_MIN.  Fixed thusly, ok for trunk?

OK.
Thanks,
Richard.

>2014-03-26  Jakub Jelinek  <jakub@redhat.com>
>
>	PR other/59545
>	* real.c (real_to_integer2): Change type of low to UHWI.
>
>--- gcc/real.c.jj	2014-01-03 11:40:37.000000000 +0100
>+++ gcc/real.c	2014-03-26 10:11:39.670655366 +0100
>@@ -1377,7 +1377,8 @@ real_to_integer2 (HOST_WIDE_INT *plow, H
> 		  const REAL_VALUE_TYPE *r)
> {
>   REAL_VALUE_TYPE t;
>-  HOST_WIDE_INT low, high;
>+  unsigned HOST_WIDE_INT low;
>+  HOST_WIDE_INT high;
>   int exp;
> 
>   switch (r->cl)
>
>	Jakub



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]