[PATCH] Another undef behavior fix
Jakub Jelinek
jakub@redhat.com
Wed Mar 26 16:06:00 GMT 2014
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?
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
More information about the Gcc-patches
mailing list