Commit 15e5ad76 by Zack Weinberg

toplev.c: Don't include setjmp.h.

	* toplev.c: Don't include setjmp.h.  Kill float_handler_set,
	float_handled, float_handler, float_signal, set_float_handler,
	and do_float_handler.  Set handler for SIGFPE to crash_signal.
	* toplev.h: Don't prototype do_float_handler.

	* c-lex.c: Fold parse_float into lex_number.  Make warning
	about portability of hex float constants more informative, and
	don't issue it on top of a syntax error.
	* fold-const.c: Fold const_binop_1 and fold_convert_1 into
	their callers.
	* real.h: Define REAL_VALUE_ABS here...
	* simplify-rtx.c: ... not here.  Fold check_fold_consts,
	simplify_unary_real, simplify_binary_real, and
	simplify_binary_is2orm1 into their callers.
	* tree.c: Fold build_real_from_int_cst_1 into caller.

	* doc/tm.texi: Document REAL_VALUE_ABS and REAL_VALUE_NEGATIVE.

	* tsystem.h: Include float.h here...
	* libgcc2.c: ... not here.

java:
	* lex.c: Change java_perform_atof to take normal parameters
	instead of a pointer to a parameter block.  Call it directly
	from java_lex.

testsuite:
	* gcc.dg/c90-hexfloat-1.c: Adjust error regexps.

From-SVN: r51336
parent 99ffa1e3
2002-03-25 Zack Weinberg <zack@codesourcery.com>
* toplev.c: Don't include setjmp.h. Kill float_handler_set,
float_handled, float_handler, float_signal, set_float_handler,
and do_float_handler. Set handler for SIGFPE to crash_signal.
* toplev.h: Don't prototype do_float_handler.
* c-lex.c: Fold parse_float into lex_number. Make warning
about portability of hex float constants more informative, and
don't issue it on top of a syntax error.
* fold-const.c: Fold const_binop_1 and fold_convert_1 into
their callers.
* real.h: Define REAL_VALUE_ABS here...
* simplify-rtx.c: ... not here. Fold check_fold_consts,
simplify_unary_real, simplify_binary_real, and
simplify_binary_is2orm1 into their callers.
* tree.c: Fold build_real_from_int_cst_1 into caller.
* doc/tm.texi: Document REAL_VALUE_ABS and REAL_VALUE_NEGATIVE.
* tsystem.h: Include float.h here...
* libgcc2.c: ... not here.
2002-03-25 Nick Clifton <nickc@cambridge.redhat.com> 2002-03-25 Nick Clifton <nickc@cambridge.redhat.com>
Fixes for: PR bootstrap/3591, target/5676 Fixes for: PR bootstrap/3591, target/5676
...@@ -52,7 +75,7 @@ ...@@ -52,7 +75,7 @@
2002-03-24 Richard Henderson <rth@redhat.com> 2002-03-24 Richard Henderson <rth@redhat.com>
* recog.c (peephole2_optimize): Split blocks when EH insns are * recog.c (peephole2_optimize): Split blocks when EH insns are
generated in the middle of a block. Do global life update if generated in the middle of a block. Do global life update if
zapped EH edges. zapped EH edges.
...@@ -63,7 +86,7 @@ ...@@ -63,7 +86,7 @@
2002-03-24 Neil Booth <neil@daikokuya.demon.co.uk> 2002-03-24 Neil Booth <neil@daikokuya.demon.co.uk>
preprocessor/3951 preprocessor/3951
* gcc.c (cpp_options): Pass -MD through as -MD not -M -MF. * gcc.c (cpp_options): Pass -MD through as -MD not -M -MF.
* cppinit.c (cpp_handle_option): Set no_ouput if -MD or -MMD. * cppinit.c (cpp_handle_option): Set no_ouput if -MD or -MMD.
(init_dependency_output): Don't make no_output decision here. (init_dependency_output): Don't make no_output decision here.
...@@ -154,7 +177,7 @@ objc: ...@@ -154,7 +177,7 @@ objc:
PR java/5489 PR java/5489
* arm.md (return, sibcall_epilogue): Pass const_true_rtx as the * arm.md (return, sibcall_epilogue): Pass const_true_rtx as the
operand argument to output_return_instruction. operand argument to output_return_instruction.
* arm.c (arm_print_operand, case 'd'): If the operand is * arm.c (arm_print_operand, case 'd'): If the operand is
const_true_rtx then just return. const_true_rtx then just return.
(arm_print_operand, case 'D'): If the operand is const_true_rtx (arm_print_operand, case 'D'): If the operand is const_true_rtx
then abort. then abort.
...@@ -171,7 +194,7 @@ objc: ...@@ -171,7 +194,7 @@ objc:
(warn_switch): Update comment. (warn_switch): Update comment.
* stmt.c (expand_end_case): Check for and, when * stmt.c (expand_end_case): Check for and, when
warn_switch_no_default, warn of a missing default case. warn_switch_no_default, warn of a missing default case.
2002-03-23 Alan Modra <amodra@bigpond.net.au> 2002-03-23 Alan Modra <amodra@bigpond.net.au>
* real.h (N): Special case 128 bit doubles. * real.h (N): Special case 128 bit doubles.
......
...@@ -921,20 +921,28 @@ package body Sem_Eval is ...@@ -921,20 +921,28 @@ package body Sem_Eval is
declare declare
Arr : constant Node_Id := Constant_Value (Entity (Prefix (Op))); Arr : constant Node_Id := Constant_Value (Entity (Prefix (Op)));
Sub : constant Node_Id := First (Expressions (Op)); Sub : constant Node_Id := First (Expressions (Op));
Ind : constant Node_Id := First_Index (Etype (Arr)); Aty : constant Node_Id := Etype (Arr);
Lbd : constant Node_Id := Type_Low_Bound (Etype (Ind));
Lin : Nat; Lin : Nat;
-- Linear one's origin subscript value for array reference -- Linear one's origin subscript value for array reference
Lbd : Node_Id;
-- Lower bound of the first array index
Elm : Node_Id; Elm : Node_Id;
-- Value from constant array -- Value from constant array
begin begin
if Ekind (Aty) = E_String_Literal_Subtype then
Lbd := String_Literal_Low_Bound (Aty);
else
Lbd := Type_Low_Bound (Etype (First_Index (Aty)));
end if;
if Compile_Time_Known_Value (Sub) if Compile_Time_Known_Value (Sub)
and then Nkind (Arr) = N_Aggregate and then Nkind (Arr) = N_Aggregate
and then Compile_Time_Known_Value (Lbd) and then Compile_Time_Known_Value (Lbd)
and then Is_Discrete_Type (Component_Type (Etype (Arr))) and then Is_Discrete_Type (Component_Type (Aty))
then then
Lin := UI_To_Int (Expr_Value (Sub) - Expr_Value (Lbd)) + 1; Lin := UI_To_Int (Expr_Value (Sub) - Expr_Value (Lbd)) + 1;
......
...@@ -84,7 +84,6 @@ int c_header_level; /* depth in C headers - C++ only */ ...@@ -84,7 +84,6 @@ int c_header_level; /* depth in C headers - C++ only */
/* Nonzero tells yylex to ignore \ in string constants. */ /* Nonzero tells yylex to ignore \ in string constants. */
static int ignore_escape_flag; static int ignore_escape_flag;
static void parse_float PARAMS ((PTR));
static tree lex_number PARAMS ((const char *, unsigned int)); static tree lex_number PARAMS ((const char *, unsigned int));
static tree lex_string PARAMS ((const unsigned char *, unsigned int, static tree lex_string PARAMS ((const unsigned char *, unsigned int,
int)); int));
...@@ -703,67 +702,6 @@ struct try_type type_sequence[] = ...@@ -703,67 +702,6 @@ struct try_type type_sequence[] =
}; };
#endif /* 0 */ #endif /* 0 */
struct pf_args
{
/* Input */
const char *str;
int fflag;
int lflag;
int base;
/* Output */
int conversion_errno;
REAL_VALUE_TYPE value;
tree type;
};
static void
parse_float (data)
PTR data;
{
struct pf_args * args = (struct pf_args *) data;
const char *typename;
args->conversion_errno = 0;
args->type = double_type_node;
typename = "double";
/* The second argument, machine_mode, of REAL_VALUE_ATOF
tells the desired precision of the binary result
of decimal-to-binary conversion. */
if (args->fflag)
{
if (args->lflag)
error ("both 'f' and 'l' suffixes on floating constant");
args->type = float_type_node;
typename = "float";
}
else if (args->lflag)
{
args->type = long_double_type_node;
typename = "long double";
}
else if (flag_single_precision_constant)
{
args->type = float_type_node;
typename = "float";
}
errno = 0;
if (args->base == 16)
args->value = REAL_VALUE_HTOF (args->str, TYPE_MODE (args->type));
else
args->value = REAL_VALUE_ATOF (args->str, TYPE_MODE (args->type));
args->conversion_errno = errno;
/* A diagnostic is required here by some ISO C testsuites.
This is not pedwarn, because some people don't want
an error for this. */
if (REAL_VALUE_ISINF (args->value) && pedantic)
warning ("floating point number exceeds range of '%s'", typename);
}
int int
c_lex (value) c_lex (value)
tree *value; tree *value;
...@@ -974,14 +912,11 @@ lex_number (str, len) ...@@ -974,14 +912,11 @@ lex_number (str, len)
if (floatflag != NOT_FLOAT) if (floatflag != NOT_FLOAT)
{ {
tree type; tree type;
int imag, fflag, lflag, conversion_errno; const char *typename;
int imag, fflag, lflag;
REAL_VALUE_TYPE real; REAL_VALUE_TYPE real;
struct pf_args args;
char *copy; char *copy;
if (base == 16 && pedantic && !flag_isoc99)
pedwarn ("floating constant may not be in radix 16");
if (base == 16 && floatflag != AFTER_EXPON) if (base == 16 && floatflag != AFTER_EXPON)
ERROR ("hexadecimal floating constant has no exponent"); ERROR ("hexadecimal floating constant has no exponent");
...@@ -1046,34 +981,45 @@ lex_number (str, len) ...@@ -1046,34 +981,45 @@ lex_number (str, len)
ERROR ("invalid suffix on floating constant"); ERROR ("invalid suffix on floating constant");
} }
/* Setup input for parse_float() */ type = double_type_node;
args.str = copy; typename = "double";
args.fflag = fflag;
args.lflag = lflag; if (fflag)
args.base = base; {
if (lflag)
ERROR ("both 'f' and 'l' suffixes on floating constant");
/* Convert string to a double, checking for overflow. */ type = float_type_node;
if (do_float_handler (parse_float, (PTR) &args)) typename = "float";
}
else if (lflag)
{ {
/* Receive output from parse_float() */ type = long_double_type_node;
real = args.value; typename = "long double";
} }
else if (flag_single_precision_constant)
{
type = float_type_node;
typename = "float";
}
/* Warn about this only after we know we're not issuing an error. */
if (base == 16 && pedantic && !flag_isoc99)
pedwarn ("hexadecimal floating constants are only valid in C99");
/* The second argument, machine_mode, of REAL_VALUE_ATOF
tells the desired precision of the binary result
of decimal-to-binary conversion. */
if (base == 16)
real = REAL_VALUE_HTOF (copy, TYPE_MODE (type));
else else
/* We got an exception from parse_float() */ real = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
ERROR ("floating constant out of range");
/* A diagnostic is required here by some ISO C testsuites.
/* Receive output from parse_float() */ This is not pedwarn, because some people don't want
conversion_errno = args.conversion_errno; an error for this. */
type = args.type; if (REAL_VALUE_ISINF (real) && pedantic)
#ifdef ERANGE
/* ERANGE is also reported for underflow,
so test the value to distinguish overflow from that. */
if (conversion_errno == ERANGE && pedantic
&& (REAL_VALUES_LESS (dconst1, real)
|| REAL_VALUES_LESS (real, dconstm1)))
warning ("floating point number exceeds range of 'double'"); warning ("floating point number exceeds range of 'double'");
#endif
/* Create a node with determined type and value. */ /* Create a node with determined type and value. */
if (imag) if (imag)
......
...@@ -7829,6 +7829,10 @@ decimal and hexadecimal floating point constants, using the syntax ...@@ -7829,6 +7829,10 @@ decimal and hexadecimal floating point constants, using the syntax
defined by the C language for both. defined by the C language for both.
@end deftypefn @end deftypefn
@deftypefn Macro int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE @var{x})
Returns 1 if @var{x} is negative (including negative zero), 0 otherwise.
@end deftypefn
@deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x}) @deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x})
Determines whether @var{x} represents infinity (positive or negative). Determines whether @var{x} represents infinity (positive or negative).
@end deftypefn @end deftypefn
...@@ -7856,6 +7860,10 @@ target's floating point format cannot represent infinity, it will call ...@@ -7856,6 +7860,10 @@ target's floating point format cannot represent infinity, it will call
Returns the negative of the floating point value @var{x}. Returns the negative of the floating point value @var{x}.
@end deftypefn @end deftypefn
@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE @var{x})
Returns the absolute value of @var{x}.
@end deftypefn
@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_TRUNCATE (REAL_VALUE_TYPE @var{mode}, enum machine_mode @var{x}) @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_TRUNCATE (REAL_VALUE_TYPE @var{mode}, enum machine_mode @var{x})
Truncates the floating point value @var{x} to fit in @var{mode}. The Truncates the floating point value @var{x} to fit in @var{mode}. The
return value is still a full-size @code{REAL_VALUE_TYPE}, but it has an return value is still a full-size @code{REAL_VALUE_TYPE}, but it has an
......
...@@ -65,11 +65,9 @@ static tree split_tree PARAMS ((tree, enum tree_code, tree *, tree *, ...@@ -65,11 +65,9 @@ static tree split_tree PARAMS ((tree, enum tree_code, tree *, tree *,
int)); int));
static tree associate_trees PARAMS ((tree, tree, enum tree_code, tree)); static tree associate_trees PARAMS ((tree, tree, enum tree_code, tree));
static tree int_const_binop PARAMS ((enum tree_code, tree, tree, int)); static tree int_const_binop PARAMS ((enum tree_code, tree, tree, int));
static void const_binop_1 PARAMS ((PTR));
static tree const_binop PARAMS ((enum tree_code, tree, tree, int)); static tree const_binop PARAMS ((enum tree_code, tree, tree, int));
static hashval_t size_htab_hash PARAMS ((const void *)); static hashval_t size_htab_hash PARAMS ((const void *));
static int size_htab_eq PARAMS ((const void *, const void *)); static int size_htab_eq PARAMS ((const void *, const void *));
static void fold_convert_1 PARAMS ((PTR));
static tree fold_convert PARAMS ((tree, tree)); static tree fold_convert PARAMS ((tree, tree));
static enum tree_code invert_tree_comparison PARAMS ((enum tree_code)); static enum tree_code invert_tree_comparison PARAMS ((enum tree_code));
static enum tree_code swap_tree_comparison PARAMS ((enum tree_code)); static enum tree_code swap_tree_comparison PARAMS ((enum tree_code));
...@@ -1199,32 +1197,6 @@ int_const_binop (code, arg1, arg2, notrunc) ...@@ -1199,32 +1197,6 @@ int_const_binop (code, arg1, arg2, notrunc)
return t; return t;
} }
/* Define input and output argument for const_binop_1. */
struct cb_args
{
enum tree_code code; /* Input: tree code for operation. */
tree type; /* Input: tree type for operation. */
REAL_VALUE_TYPE d1, d2; /* Input: floating point operands. */
tree t; /* Output: constant for result. */
};
/* Do the real arithmetic for const_binop while protected by a
float overflow handler. */
static void
const_binop_1 (data)
PTR data;
{
struct cb_args *args = (struct cb_args *) data;
REAL_VALUE_TYPE value;
REAL_ARITHMETIC (value, args->code, args->d1, args->d2);
args->t
= build_real (args->type,
real_value_truncate (TYPE_MODE (args->type), value));
}
/* Combine two constants ARG1 and ARG2 under operation CODE to produce a new /* Combine two constants ARG1 and ARG2 under operation CODE to produce a new
constant. We assume ARG1 and ARG2 have the same data type, or at least constant. We assume ARG1 and ARG2 have the same data type, or at least
are the same kind of constant and the same machine mode. are the same kind of constant and the same machine mode.
...@@ -1247,9 +1219,8 @@ const_binop (code, arg1, arg2, notrunc) ...@@ -1247,9 +1219,8 @@ const_binop (code, arg1, arg2, notrunc)
{ {
REAL_VALUE_TYPE d1; REAL_VALUE_TYPE d1;
REAL_VALUE_TYPE d2; REAL_VALUE_TYPE d2;
int overflow = 0; REAL_VALUE_TYPE value;
tree t; tree t;
struct cb_args args;
d1 = TREE_REAL_CST (arg1); d1 = TREE_REAL_CST (arg1);
d2 = TREE_REAL_CST (arg2); d2 = TREE_REAL_CST (arg2);
...@@ -1261,24 +1232,14 @@ const_binop (code, arg1, arg2, notrunc) ...@@ -1261,24 +1232,14 @@ const_binop (code, arg1, arg2, notrunc)
else if (REAL_VALUE_ISNAN (d2)) else if (REAL_VALUE_ISNAN (d2))
return arg2; return arg2;
/* Setup input for const_binop_1() */ REAL_ARITHMETIC (value, code, d1, d2);
args.type = TREE_TYPE (arg1);
args.d1 = d1;
args.d2 = d2;
args.code = code;
if (do_float_handler (const_binop_1, (PTR) &args)) t = build_real (TREE_TYPE (arg1),
/* Receive output from const_binop_1. */ real_value_truncate (TYPE_MODE (TREE_TYPE (arg1)),
t = args.t; value));
else
{
/* We got an exception from const_binop_1. */
t = copy_node (arg1);
overflow = 1;
}
TREE_OVERFLOW (t) TREE_OVERFLOW (t)
= (force_fit_type (t, overflow) = (force_fit_type (t, 0)
| TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2)); | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2));
TREE_CONSTANT_OVERFLOW (t) TREE_CONSTANT_OVERFLOW (t)
= TREE_OVERFLOW (t) = TREE_OVERFLOW (t)
...@@ -1530,27 +1491,6 @@ size_diffop (arg0, arg1) ...@@ -1530,27 +1491,6 @@ size_diffop (arg0, arg1)
convert (ctype, size_binop (MINUS_EXPR, arg1, arg0))); convert (ctype, size_binop (MINUS_EXPR, arg1, arg0)));
} }
/* This structure is used to communicate arguments to fold_convert_1. */
struct fc_args
{
tree arg1; /* Input: value to convert. */
tree type; /* Input: type to convert value to. */
tree t; /* Output: result of conversion. */
};
/* Function to convert floating-point constants, protected by floating
point exception handler. */
static void
fold_convert_1 (data)
PTR data;
{
struct fc_args *args = (struct fc_args *) data;
args->t = build_real (args->type,
real_value_truncate (TYPE_MODE (args->type),
TREE_REAL_CST (args->arg1)));
}
/* Given T, a tree representing type conversion of ARG1, a constant, /* Given T, a tree representing type conversion of ARG1, a constant,
return a constant tree representing the result of conversion. */ return a constant tree representing the result of conversion. */
...@@ -1650,8 +1590,6 @@ fold_convert (t, arg1) ...@@ -1650,8 +1590,6 @@ fold_convert (t, arg1)
return build_real_from_int_cst (type, arg1); return build_real_from_int_cst (type, arg1);
if (TREE_CODE (arg1) == REAL_CST) if (TREE_CODE (arg1) == REAL_CST)
{ {
struct fc_args args;
if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))) if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1)))
{ {
t = arg1; t = arg1;
...@@ -1659,24 +1597,12 @@ fold_convert (t, arg1) ...@@ -1659,24 +1597,12 @@ fold_convert (t, arg1)
return t; return t;
} }
/* Setup input for fold_convert_1() */ t = build_real (type,
args.arg1 = arg1; real_value_truncate (TYPE_MODE (type),
args.type = type; TREE_REAL_CST (arg1)));
if (do_float_handler (fold_convert_1, (PTR) &args))
{
/* Receive output from fold_convert_1() */
t = args.t;
}
else
{
/* We got an exception from fold_convert_1() */
overflow = 1;
t = copy_node (arg1);
}
TREE_OVERFLOW (t) TREE_OVERFLOW (t)
= TREE_OVERFLOW (arg1) | force_fit_type (t, overflow); = TREE_OVERFLOW (arg1) | force_fit_type (t, 0);
TREE_CONSTANT_OVERFLOW (t) TREE_CONSTANT_OVERFLOW (t)
= TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1); = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1);
return t; return t;
......
2002-03-25 Zack Weinberg <zack@codesourcery.com>
* lex.c: Change java_perform_atof to take normal parameters
instead of a pointer to a parameter block. Call it directly
from java_lex.
2002-03-22 Mark Wielaard <mark@klomp.org> 2002-03-22 Mark Wielaard <mark@klomp.org>
Fix for PR java/5368: Fix for PR java/5368:
...@@ -32,10 +38,10 @@ ...@@ -32,10 +38,10 @@
2002-03-20 Nic Ferrier <nferrier@tapsellferrier.co.uk> 2002-03-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
* gcj.texi: @code{gcj} becomes @command{gcj}. * gcj.texi: @code{gcj} becomes @command{gcj}.
@code{gcc} becomes @command{gcc}. @code{gcc} becomes @command{gcc}.
GcjRaw changed to gnu.gcc.RawData. GcjRaw changed to gnu.gcc.RawData.
2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk> 2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
* decl.c (start_java_method): Use new hook. * decl.c (start_java_method): Use new hook.
...@@ -257,18 +263,18 @@ ...@@ -257,18 +263,18 @@
2002-02-20 Nic Ferrier <nferrier@tapsellferrier.co.uk> 2002-02-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
* gcj.texi: Option `--classpath' becomes `--CLASSPATH.'Option * gcj.texi: Option `--classpath' becomes `--CLASSPATH.'Option
`--CLASSPATH' becomes `--classpath.' `--CLASSPATH' becomes `--classpath.'
* gjavah.c: Likewise. * gjavah.c: Likewise.
* jcf-dump.c: Likewise. * jcf-dump.c: Likewise.
* lang-options.h: Likewise. * lang-options.h: Likewise.
* lang.c: Likewise. * lang.c: Likewise.
* jcf-path.c: Updated comment. * jcf-path.c: Updated comment.
(jcf_path_classpath_arg): Renamed `jcf_path_CLASSPATH_arg.' (jcf_path_classpath_arg): Renamed `jcf_path_CLASSPATH_arg.'
(jcf_path_CLASSPATH_arg): Renamed `jcf_path_classpath_arg.' (jcf_path_CLASSPATH_arg): Renamed `jcf_path_classpath_arg.'
* jcf.h (jcf_path_CLASSPATH_arg): Ditto. * jcf.h (jcf_path_CLASSPATH_arg): Ditto.
(jcf_path_CLASSPATH_arg): Ditto. (jcf_path_CLASSPATH_arg): Ditto.
(classpath_u): Updated leading comment. (classpath_u): Updated leading comment.
2002-02-20 Per Bothner <per@bothner.com> 2002-02-20 Per Bothner <per@bothner.com>
...@@ -352,7 +358,7 @@ ...@@ -352,7 +358,7 @@
current_function_decl before building JNI stub. current_function_decl before building JNI stub.
2002-01-26 Andreas Tobler <a.tobler@schweiz.ch> 2002-01-26 Andreas Tobler <a.tobler@schweiz.ch>
* gcc/java/builtins.c (sqrt_builtin): Use BUILT_IN_SQRT, not * gcc/java/builtins.c (sqrt_builtin): Use BUILT_IN_SQRT, not
BUILT_IN_SQRTF. BUILT_IN_SQRTF.
......
...@@ -828,38 +828,33 @@ java_parse_escape_sequence () ...@@ -828,38 +828,33 @@ java_parse_escape_sequence ()
} }
} }
/* Isolate the code which may raise an arithmetic exception in its
own function. */
#ifndef JC1_LITE #ifndef JC1_LITE
struct jpa_args
{
YYSTYPE *java_lval;
char *literal_token;
int fflag;
int number_beginning;
};
#define IS_ZERO(X) (ereal_cmp (X, dconst0) == 0) #define IS_ZERO(X) (ereal_cmp (X, dconst0) == 0)
static void java_perform_atof PARAMS ((PTR)); /* Subroutine of java_lex: converts floating-point literals to tree
nodes. LITERAL_TOKEN is the input literal, JAVA_LVAL is where to
store the result. FFLAG indicates whether the literal was tagged
with an 'f', indicating it is of type 'float'; NUMBER_BEGINNING
is the line number on which to report any error. */
static void java_perform_atof PARAMS ((YYSTYPE *, char *, int, int));
static void static void
java_perform_atof (av) java_perform_atof (java_lval, literal_token, fflag, number_beginning)
PTR av; YYSTYPE *java_lval;
char *literal_token;
int fflag;
int number_beginning;
{ {
struct jpa_args *a = (struct jpa_args *)av;
YYSTYPE *java_lval = a->java_lval;
int number_beginning = a->number_beginning;
REAL_VALUE_TYPE value; REAL_VALUE_TYPE value;
tree type = (a->fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE); tree type = (fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
SET_REAL_VALUE_ATOF (value, SET_REAL_VALUE_ATOF (value,
REAL_VALUE_ATOF (a->literal_token, TYPE_MODE (type))); REAL_VALUE_ATOF (literal_token, TYPE_MODE (type)));
if (REAL_VALUE_ISINF (value) || REAL_VALUE_ISNAN (value)) if (REAL_VALUE_ISINF (value) || REAL_VALUE_ISNAN (value))
{ {
JAVA_FLOAT_RANGE_ERROR ((a->fflag ? "float" : "double")); JAVA_FLOAT_RANGE_ERROR (fflag ? "float" : "double");
value = DCONST0; value = DCONST0;
} }
else if (IS_ZERO (value)) else if (IS_ZERO (value))
...@@ -867,7 +862,7 @@ java_perform_atof (av) ...@@ -867,7 +862,7 @@ java_perform_atof (av)
/* We check to see if the value is really 0 or if we've found an /* We check to see if the value is really 0 or if we've found an
underflow. We do this in the most primitive imaginable way. */ underflow. We do this in the most primitive imaginable way. */
int really_zero = 1; int really_zero = 1;
char *p = a->literal_token; char *p = literal_token;
if (*p == '-') if (*p == '-')
++p; ++p;
while (*p && *p != 'e' && *p != 'E') while (*p && *p != 'e' && *p != 'E')
...@@ -1161,9 +1156,6 @@ java_lex (java_lval) ...@@ -1161,9 +1156,6 @@ java_lex (java_lval)
} }
else else
{ {
#ifndef JC1_LITE
struct jpa_args a;
#endif
if (stage != 4) /* Don't push back fF/dD. */ if (stage != 4) /* Don't push back fF/dD. */
java_unget_unicode (); java_unget_unicode ();
...@@ -1176,17 +1168,10 @@ java_lex (java_lval) ...@@ -1176,17 +1168,10 @@ java_lex (java_lval)
JAVA_LEX_LIT (literal_token, radix); JAVA_LEX_LIT (literal_token, radix);
#ifndef JC1_LITE #ifndef JC1_LITE
a.literal_token = literal_token; java_perform_atof (java_lval, literal_token,
a.fflag = fflag; fflag, number_beginning);
a.java_lval = java_lval;
a.number_beginning = number_beginning;
if (do_float_handler (java_perform_atof, (PTR) &a))
return FP_LIT_TK;
JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
#else
return FP_LIT_TK;
#endif #endif
return FP_LIT_TK;
} }
} }
} /* JAVA_ASCII_FPCHAR (c) */ } /* JAVA_ASCII_FPCHAR (c) */
......
...@@ -1065,11 +1065,8 @@ __floatdidf (DWtype u) ...@@ -1065,11 +1065,8 @@ __floatdidf (DWtype u)
#define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
#define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2)) #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
#define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
#define DI_SIZE (sizeof (DWtype) * BITS_PER_UNIT)
/* GCC guarantees this header exists at this point. */
#include <float.h>
#define DI_SIZE (sizeof (DWtype) * BITS_PER_UNIT)
#define DF_SIZE DBL_MANT_DIG #define DF_SIZE DBL_MANT_DIG
#define SF_SIZE FLT_MANT_DIG #define SF_SIZE FLT_MANT_DIG
......
...@@ -161,6 +161,10 @@ extern REAL_VALUE_TYPE real_value_truncate PARAMS ((enum machine_mode, ...@@ -161,6 +161,10 @@ extern REAL_VALUE_TYPE real_value_truncate PARAMS ((enum machine_mode,
#define REAL_VALUE_NEGATE ereal_negate #define REAL_VALUE_NEGATE ereal_negate
/* Compute the absolute value of a floating-point value X. */
#define REAL_VALUE_ABS(x) \
(REAL_VALUE_NEGATIVE (x) ? REAL_VALUE_NEGATE (x) : (x))
/* Determine whether a floating-point value X is infinite. */ /* Determine whether a floating-point value X is infinite. */
#define REAL_VALUE_ISINF(x) (target_isinf (x)) #define REAL_VALUE_ISINF(x) (target_isinf (x))
......
2002-03-25 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/c90-hexfloat-1.c: Adjust error regexps.
2002-03-25 Bob Wilson <bob.wilson@acm.org> 2002-03-25 Bob Wilson <bob.wilson@acm.org>
* g++.old-deja/g++.jason/thunk3.C: Add xtensa-*-* to list of * g++.old-deja/g++.jason/thunk3.C: Add xtensa-*-* to list of
...@@ -62,7 +66,7 @@ ...@@ -62,7 +66,7 @@
2002-03-22 Neil Booth <neil@daikokuya.demon.co.uk> 2002-03-22 Neil Booth <neil@daikokuya.demon.co.uk>
* gcc.dg/cpp/multiline.c: Update to match. * gcc.dg/cpp/multiline.c: Update to match.
2002-03-22 Alexandre Oliva <aoliva@redhat.com> 2002-03-22 Alexandre Oliva <aoliva@redhat.com>
...@@ -74,13 +78,13 @@ ...@@ -74,13 +78,13 @@
2002-03-21 David Edelsohn <edelsohn@gnu.org> 2002-03-21 David Edelsohn <edelsohn@gnu.org>
* gcc.dg/20020312-2.c: Add rs6000 target. * gcc.dg/20020312-2.c: Add rs6000 target.
* gcc.c-torture/compile/20020319-1.c: New test. * gcc.c-torture/compile/20020319-1.c: New test.
2002-03-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> 2002-03-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* g++.old-deja/g++.eh/ia64-1.C: Use [ijkl]_[0-9] as variable names. * g++.old-deja/g++.eh/ia64-1.C: Use [ijkl]_[0-9] as variable names.
(A, E): Handle this. (A, E): Handle this.
2002-03-20 Jason Merrill <jason@redhat.com> 2002-03-20 Jason Merrill <jason@redhat.com>
...@@ -197,7 +201,7 @@ Thu Mar 14 14:28:38 2002 Jeffrey A Law (law@cygnus.com) ...@@ -197,7 +201,7 @@ Thu Mar 14 14:28:38 2002 Jeffrey A Law (law@cygnus.com)
2002-03-12 David Edelsohn <edelsohn@gnu.org> 2002-03-12 David Edelsohn <edelsohn@gnu.org>
* gcc.dg/20020103-1.c: Add rs6000 target and macro. * gcc.dg/20020103-1.c: Add rs6000 target and macro.
2002-03-12 Roger Sayle <roger@eyesopen.com> 2002-03-12 Roger Sayle <roger@eyesopen.com>
...@@ -205,7 +209,7 @@ Thu Mar 14 14:28:38 2002 Jeffrey A Law (law@cygnus.com) ...@@ -205,7 +209,7 @@ Thu Mar 14 14:28:38 2002 Jeffrey A Law (law@cygnus.com)
2002-03-11 Aldy Hernandez <aldyh@redhat.com> 2002-03-11 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/altivec-1.c: Cleanup and use altivec.h. * gcc.dg/altivec-1.c: Cleanup and use altivec.h.
2002-03-11 Richard Henderson <rth@redhat.com> 2002-03-11 Richard Henderson <rth@redhat.com>
...@@ -279,7 +283,7 @@ Thu Mar 7 10:05:31 2002 Jeffrey A Law (law@redhat.com) ...@@ -279,7 +283,7 @@ Thu Mar 7 10:05:31 2002 Jeffrey A Law (law@redhat.com)
2002-03-03 Aldy Hernandez <aldyh@redhat.com> 2002-03-03 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/20020103-1.c: Add other -D ppc variants. * gcc.dg/20020103-1.c: Add other -D ppc variants.
2002-03-02 Nathan Sidwell <nathan@codesourcery.com> 2002-03-02 Nathan Sidwell <nathan@codesourcery.com>
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
double d = 0x1.2p2; /* { dg-bogus "warning" "warning in place of error" } */ double d = 0x1.2p2; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "radix 16" "hex float error" { target *-*-* } 6 } */ /* { dg-error "hexadecimal floating" "hex float error" { target *-*-* } 6 } */
double d1 = 0x1p2; /* { dg-bogus "warning" "warning in place of error" } */ double d1 = 0x1p2; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "radix 16" "hex float error" { target *-*-* } 8 } */ /* { dg-error "hexadecimal floating" "hex float error" { target *-*-* } 8 } */
double d2 = 0x1...p2; /* { dg-bogus "warning" "warning in place of error" } */ double d2 = 0x1...p2; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "too many decimal points" "bad hex float" { target *-*-* } 10 } */ /* { dg-error "too many decimal points" "bad hex float" { target *-*-* } 10 } */
...@@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#undef FFS /* Some systems define this in param.h. */ #undef FFS /* Some systems define this in param.h. */
#include "system.h" #include "system.h"
#include <signal.h> #include <signal.h>
#include <setjmp.h>
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h> # include <sys/resource.h>
...@@ -109,9 +108,7 @@ static void finalize PARAMS ((void)); ...@@ -109,9 +108,7 @@ static void finalize PARAMS ((void));
static void set_target_switch PARAMS ((const char *)); static void set_target_switch PARAMS ((const char *));
static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN; static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
static void set_float_handler PARAMS ((jmp_buf));
static void compile_file PARAMS ((void)); static void compile_file PARAMS ((void));
static void display_help PARAMS ((void)); static void display_help PARAMS ((void));
static void display_target_options PARAMS ((void)); static void display_target_options PARAMS ((void));
...@@ -1626,73 +1623,6 @@ floor_log2_wide (x) ...@@ -1626,73 +1623,6 @@ floor_log2_wide (x)
return log; return log;
} }
static int float_handler_set;
int float_handled;
jmp_buf float_handler;
/* Signals actually come here. */
static void
float_signal (signo)
/* If this is missing, some compilers complain. */
int signo ATTRIBUTE_UNUSED;
{
if (float_handled == 0)
crash_signal (signo);
float_handled = 0;
/* On System-V derived systems, we must reinstall the signal handler.
This is harmless on BSD-derived systems. */
signal (SIGFPE, float_signal);
longjmp (float_handler, 1);
}
/* Specify where to longjmp to when a floating arithmetic error happens.
If HANDLER is 0, it means don't handle the errors any more. */
static void
set_float_handler (handler)
jmp_buf handler;
{
float_handled = (handler != 0);
if (handler)
memcpy (float_handler, handler, sizeof (float_handler));
if (float_handled && ! float_handler_set)
{
signal (SIGFPE, float_signal);
float_handler_set = 1;
}
}
/* This is a wrapper function for code which might elicit an
arithmetic exception. That code should be passed in as a function
pointer FN, and one argument DATA. DATA is usually a struct which
contains the real input and output for function FN. This function
returns 0 (failure) if longjmp was called (i.e. an exception
occurred.) It returns 1 (success) otherwise. */
int
do_float_handler (fn, data)
void (*fn) PARAMS ((PTR));
PTR data;
{
jmp_buf buf;
if (setjmp (buf))
{
/* We got here via longjmp () caused by an exception in function
fn (). */
set_float_handler (NULL);
return 0;
}
set_float_handler (buf);
(*fn)(data);
set_float_handler (NULL);
return 1;
}
/* Handler for fatal signals, such as SIGSEGV. These are transformed /* Handler for fatal signals, such as SIGSEGV. These are transformed
into ICE messages, which is much more user friendly. */ into ICE messages, which is much more user friendly. */
...@@ -4565,10 +4495,6 @@ general_init (argv0) ...@@ -4565,10 +4495,6 @@ general_init (argv0)
gcc_init_libintl (); gcc_init_libintl ();
/* Install handler for SIGFPE, which may be received while we do
compile-time floating point arithmetic. */
signal (SIGFPE, float_signal);
/* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */ /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
#ifdef SIGSEGV #ifdef SIGSEGV
signal (SIGSEGV, crash_signal); signal (SIGSEGV, crash_signal);
...@@ -4585,6 +4511,9 @@ general_init (argv0) ...@@ -4585,6 +4511,9 @@ general_init (argv0)
#if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT) #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
signal (SIGIOT, crash_signal); signal (SIGIOT, crash_signal);
#endif #endif
#ifdef SIGFPE
signal (SIGFPE, crash_signal);
#endif
/* Initialize the diagnostics reporting machinery, so option parsing /* Initialize the diagnostics reporting machinery, so option parsing
can give warnings and errors. */ can give warnings and errors. */
......
...@@ -88,7 +88,6 @@ extern void error_for_asm PARAMS ((struct rtx_def *, ...@@ -88,7 +88,6 @@ extern void error_for_asm PARAMS ((struct rtx_def *,
extern void warning_for_asm PARAMS ((struct rtx_def *, extern void warning_for_asm PARAMS ((struct rtx_def *,
const char *, ...)); const char *, ...));
extern void warn_deprecated_use PARAMS ((union tree_node *)); extern void warn_deprecated_use PARAMS ((union tree_node *));
extern int do_float_handler PARAMS ((void (*) (PTR), PTR));
#ifdef BUFSIZ #ifdef BUFSIZ
extern void output_quoted_string PARAMS ((FILE *, const char *)); extern void output_quoted_string PARAMS ((FILE *, const char *));
......
...@@ -122,7 +122,6 @@ struct type_hash ...@@ -122,7 +122,6 @@ struct type_hash
htab_t type_hash_table; htab_t type_hash_table;
static void build_real_from_int_cst_1 PARAMS ((PTR));
static void set_type_quals PARAMS ((tree, int)); static void set_type_quals PARAMS ((tree, int));
static void append_random_chars PARAMS ((char *)); static void append_random_chars PARAMS ((char *));
static int type_hash_eq PARAMS ((const void*, const void*)); static int type_hash_eq PARAMS ((const void*, const void*));
...@@ -591,31 +590,8 @@ real_value_from_int_cst (type, i) ...@@ -591,31 +590,8 @@ real_value_from_int_cst (type, i)
return d; return d;
} }
/* Args to pass to and from build_real_from_int_cst_1. */
struct brfic_args
{
tree type; /* Input: type to conver to. */
tree i; /* Input: operand to convert. */
REAL_VALUE_TYPE d; /* Output: floating point value. */
};
/* Convert an integer to a floating point value while protected by a floating
point exception handler. */
static void
build_real_from_int_cst_1 (data)
PTR data;
{
struct brfic_args *args = (struct brfic_args *) data;
args->d = real_value_from_int_cst (args->type, args->i);
}
/* Given a tree representing an integer constant I, return a tree /* Given a tree representing an integer constant I, return a tree
representing the same value as a floating-point constant of type TYPE. representing the same value as a floating-point constant of type TYPE. */
We cannot perform this operation if there is no way of doing arithmetic
on floating-point values. */
tree tree
build_real_from_int_cst (type, i) build_real_from_int_cst (type, i)
...@@ -625,27 +601,13 @@ build_real_from_int_cst (type, i) ...@@ -625,27 +601,13 @@ build_real_from_int_cst (type, i)
tree v; tree v;
int overflow = TREE_OVERFLOW (i); int overflow = TREE_OVERFLOW (i);
REAL_VALUE_TYPE d; REAL_VALUE_TYPE d;
struct brfic_args args;
v = make_node (REAL_CST); v = make_node (REAL_CST);
TREE_TYPE (v) = type; TREE_TYPE (v) = type;
/* Setup input for build_real_from_int_cst_1() */ d = real_value_from_int_cst (type, i);
args.type = type;
args.i = i;
if (do_float_handler (build_real_from_int_cst_1, (PTR) &args))
/* Receive output from build_real_from_int_cst_1() */
d = args.d;
else
{
/* We got an exception from build_real_from_int_cst_1() */
d = dconst0;
overflow = 1;
}
/* Check for valid float value for this type on this target machine. */ /* Check for valid float value for this type on this target machine. */
#ifdef CHECK_FLOAT_VALUE #ifdef CHECK_FLOAT_VALUE
CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow); CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
#endif #endif
......
...@@ -33,8 +33,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -33,8 +33,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define HAVE_DECL_GETOPT 1 #define HAVE_DECL_GETOPT 1
#endif #endif
/* GCC supplies this header. */ /* GCC supplies these headers. */
#include <stddef.h> #include <stddef.h>
#include <float.h>
#ifdef inhibit_libc #ifdef inhibit_libc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment