aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-05-24 04:30:40 +0000
committerRichard Stallman <rms@gnu.org>1992-05-24 04:30:40 +0000
commit7c7b029dab4406214c1deb7e43ddcfd10227f932 (patch)
tree4dc0932b72c3b6a767d2541c4cea1b78ef428747 /gcc
parent329d2160a4f77a1409ae55f0067d699542498fa3 (diff)
downloadgcc-7c7b029dab4406214c1deb7e43ddcfd10227f932.zip
gcc-7c7b029dab4406214c1deb7e43ddcfd10227f932.tar.gz
gcc-7c7b029dab4406214c1deb7e43ddcfd10227f932.tar.bz2
*** empty log message ***
From-SVN: r1070
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index dd26986..fcabebd 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -45,6 +45,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "flags.h"
#include "tree.h"
+/* Handle floating overflow for `const_binop'. */
+static jmp_buf float_error;
+
void lshift_double ();
void rshift_double ();
void lrotate_double ();
@@ -938,9 +941,6 @@ split_tree (in, code, varp, conp, varsignp)
We assume ARG1 and ARG2 have the same data type,
or at least are the same kind of constant and the same machine mode. */
-/* Handle floating overflow for `const_binop'. */
-static jmp_buf const_binop_error;
-
static tree
const_binop (code, arg1, arg2)
enum tree_code code;
@@ -1165,15 +1165,16 @@ const_binop (code, arg1, arg2)
register REAL_VALUE_TYPE d1;
register REAL_VALUE_TYPE d2;
register REAL_VALUE_TYPE value;
+ tree t;
d1 = TREE_REAL_CST (arg1);
d2 = TREE_REAL_CST (arg2);
- if (setjmp (const_binop_error))
+ if (setjmp (float_error))
{
warning ("floating overflow in constant folding");
return build (code, TREE_TYPE (arg1), arg1, arg2);
}
- set_float_handler (const_binop_error);
+ set_float_handler (float_error);
#ifdef REAL_ARITHMETIC
REAL_ARITHMETIC (value, code, d1, d2);
@@ -1213,9 +1214,10 @@ const_binop (code, arg1, arg2)
abort ();
}
#endif /* no REAL_ARITHMETIC */
+ t = build_real (TREE_TYPE (arg1),
+ REAL_VALUE_TRUNCATE (TYPE_MODE (TREE_TYPE (arg1)), value));
set_float_handler (0);
- return build_real (TREE_TYPE (arg1),
- REAL_VALUE_TRUNCATE (TYPE_MODE (TREE_TYPE (arg1)), value));
+ return t;
}
#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
if (TREE_CODE (arg1) == COMPLEX_CST)
@@ -1413,8 +1415,19 @@ fold_convert (t, arg1)
return build_real_from_int_cst (type, arg1);
#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
if (TREE_CODE (arg1) == REAL_CST)
- return build_real (type, REAL_VALUE_TRUNCATE (TYPE_MODE (type),
- TREE_REAL_CST (arg1)));
+ {
+ if (setjmp (float_error))
+ {
+ warning ("floating overflow in constant folding");
+ return t;
+ }
+ set_float_handler (float_error);
+
+ t = build_real (type, REAL_VALUE_TRUNCATE (TYPE_MODE (type),
+ TREE_REAL_CST (arg1)));
+ set_float_handler (0);
+ return t;
+ }
}
TREE_CONSTANT (t) = 1;
return t;