summaryrefslogtreecommitdiffstats
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-03-13 13:29:32 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-03-13 13:29:32 +0000
commit1aa16793f8feb588b21d9136dc171e82c7136189 (patch)
tree2a7bcc523f98a74396bbca1ee340e4036b64feed /gcc/tree.c
parent42e1c9da95deecbfb602db0747c8441e21b5fff7 (diff)
downloadppe42-gcc-1aa16793f8feb588b21d9136dc171e82c7136189.tar.gz
ppe42-gcc-1aa16793f8feb588b21d9136dc171e82c7136189.zip
Include setjmp.h.
(build_real_from_int_cst): Propagate overflow flags and establish float handler. (build_complex): Propagate overflow flags. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6766 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 8dd5a1a0e95..d7541943288 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -32,6 +32,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
are used also for allocating many other kinds of objects
by all passes of the compiler. */
+#include <setjmp.h>
#include "config.h"
#include "flags.h"
#include "tree.h"
@@ -1292,19 +1293,35 @@ build_real_from_int_cst (type, i)
tree i;
{
tree v;
+ int overflow = TREE_OVERFLOW (i);
REAL_VALUE_TYPE d;
+ jmp_buf float_error;
v = make_node (REAL_CST);
TREE_TYPE (v) = type;
+ if (setjmp (float_error))
+ {
+ d = dconst0;
+ overflow = 1;
+ goto got_it;
+ }
+
+ set_float_handler (float_error);
+
d = REAL_VALUE_TRUNCATE (TYPE_MODE (type), real_value_from_int_cst (i));
- /* Check for valid float value for this type on this target machine;
- if not, can print error message and store a valid value in D. */
+
+ /* Check for valid float value for this type on this target machine. */
+
+ got_it:
+ set_float_handler (NULL_PTR);
+
#ifdef CHECK_FLOAT_VALUE
- CHECK_FLOAT_VALUE (TYPE_MODE (type), d);
+ CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
#endif
TREE_REAL_CST (v) = d;
+ TREE_OVERFLOW (v) = TREE_CONSTANT_OVERFLOW (v) = overflow;
return v;
}
@@ -1339,9 +1356,13 @@ build_complex (real, imag)
tree real, imag;
{
register tree t = make_node (COMPLEX_CST);
+
TREE_REALPART (t) = real;
TREE_IMAGPART (t) = imag;
TREE_TYPE (t) = build_complex_type (TREE_TYPE (real));
+ TREE_OVERFLOW (t) = TREE_OVERFLOW (real) | TREE_OVERFLOW (imag);
+ TREE_CONSTANT_OVERFLOW (t)
+ = TREE_CONSTANT_OVERFLOW (real) | TREE_CONSTANT_OVERFLOW (imag);
return t;
}
OpenPOWER on IntegriCloud