This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Another undef behavior fix
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>,Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 26 Mar 2014 19:53:53 +0100
- Subject: Re: [PATCH] Another undef behavior fix
- Authentication-results: sourceware.org; auth=none
- References: <20140326155728 dot GH1817 at tucnak dot redhat dot com>
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