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
This commit is contained in:
parent
99ffa1e37a
commit
15e5ad7698
16 changed files with 218 additions and 561 deletions
|
@ -1,3 +1,26 @@
|
|||
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>
|
||||
|
||||
Fixes for: PR bootstrap/3591, target/5676
|
||||
|
@ -52,7 +75,7 @@
|
|||
|
||||
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
|
||||
zapped EH edges.
|
||||
|
||||
|
@ -63,7 +86,7 @@
|
|||
2002-03-24 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
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.
|
||||
(init_dependency_output): Don't make no_output decision here.
|
||||
|
||||
|
@ -154,7 +177,7 @@ objc:
|
|||
PR java/5489
|
||||
* arm.md (return, sibcall_epilogue): Pass const_true_rtx as the
|
||||
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.
|
||||
(arm_print_operand, case 'D'): If the operand is const_true_rtx
|
||||
then abort.
|
||||
|
@ -171,7 +194,7 @@ objc:
|
|||
(warn_switch): Update comment.
|
||||
* stmt.c (expand_end_case): Check for and, when
|
||||
warn_switch_no_default, warn of a missing default case.
|
||||
|
||||
|
||||
2002-03-23 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* real.h (N): Special case 128 bit doubles.
|
||||
|
|
|
@ -921,20 +921,28 @@ package body Sem_Eval is
|
|||
declare
|
||||
Arr : constant Node_Id := Constant_Value (Entity (Prefix (Op)));
|
||||
Sub : constant Node_Id := First (Expressions (Op));
|
||||
Ind : constant Node_Id := First_Index (Etype (Arr));
|
||||
Lbd : constant Node_Id := Type_Low_Bound (Etype (Ind));
|
||||
Aty : constant Node_Id := Etype (Arr);
|
||||
|
||||
Lin : Nat;
|
||||
-- Linear one's origin subscript value for array reference
|
||||
|
||||
Lbd : Node_Id;
|
||||
-- Lower bound of the first array index
|
||||
|
||||
Elm : Node_Id;
|
||||
-- Value from constant array
|
||||
|
||||
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)
|
||||
and then Nkind (Arr) = N_Aggregate
|
||||
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
|
||||
Lin := UI_To_Int (Expr_Value (Sub) - Expr_Value (Lbd)) + 1;
|
||||
|
||||
|
|
130
gcc/c-lex.c
130
gcc/c-lex.c
|
@ -84,7 +84,6 @@ int c_header_level; /* depth in C headers - C++ only */
|
|||
/* Nonzero tells yylex to ignore \ in string constants. */
|
||||
static int ignore_escape_flag;
|
||||
|
||||
static void parse_float PARAMS ((PTR));
|
||||
static tree lex_number PARAMS ((const char *, unsigned int));
|
||||
static tree lex_string PARAMS ((const unsigned char *, unsigned int,
|
||||
int));
|
||||
|
@ -703,67 +702,6 @@ struct try_type type_sequence[] =
|
|||
};
|
||||
#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
|
||||
c_lex (value)
|
||||
tree *value;
|
||||
|
@ -974,14 +912,11 @@ lex_number (str, len)
|
|||
if (floatflag != NOT_FLOAT)
|
||||
{
|
||||
tree type;
|
||||
int imag, fflag, lflag, conversion_errno;
|
||||
const char *typename;
|
||||
int imag, fflag, lflag;
|
||||
REAL_VALUE_TYPE real;
|
||||
struct pf_args args;
|
||||
char *copy;
|
||||
|
||||
if (base == 16 && pedantic && !flag_isoc99)
|
||||
pedwarn ("floating constant may not be in radix 16");
|
||||
|
||||
if (base == 16 && floatflag != AFTER_EXPON)
|
||||
ERROR ("hexadecimal floating constant has no exponent");
|
||||
|
||||
|
@ -1046,34 +981,45 @@ lex_number (str, len)
|
|||
ERROR ("invalid suffix on floating constant");
|
||||
}
|
||||
|
||||
/* Setup input for parse_float() */
|
||||
args.str = copy;
|
||||
args.fflag = fflag;
|
||||
args.lflag = lflag;
|
||||
args.base = base;
|
||||
|
||||
/* Convert string to a double, checking for overflow. */
|
||||
if (do_float_handler (parse_float, (PTR) &args))
|
||||
type = double_type_node;
|
||||
typename = "double";
|
||||
|
||||
if (fflag)
|
||||
{
|
||||
/* Receive output from parse_float() */
|
||||
real = args.value;
|
||||
}
|
||||
else
|
||||
/* We got an exception from parse_float() */
|
||||
ERROR ("floating constant out of range");
|
||||
if (lflag)
|
||||
ERROR ("both 'f' and 'l' suffixes on floating constant");
|
||||
|
||||
/* Receive output from parse_float() */
|
||||
conversion_errno = args.conversion_errno;
|
||||
type = args.type;
|
||||
|
||||
#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)))
|
||||
type = float_type_node;
|
||||
typename = "float";
|
||||
}
|
||||
else if (lflag)
|
||||
{
|
||||
type = long_double_type_node;
|
||||
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
|
||||
real = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
|
||||
|
||||
/* 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 (real) && pedantic)
|
||||
warning ("floating point number exceeds range of 'double'");
|
||||
#endif
|
||||
|
||||
/* Create a node with determined type and value. */
|
||||
if (imag)
|
||||
|
|
|
@ -7829,6 +7829,10 @@ decimal and hexadecimal floating point constants, using the syntax
|
|||
defined by the C language for both.
|
||||
@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})
|
||||
Determines whether @var{x} represents infinity (positive or negative).
|
||||
@end deftypefn
|
||||
|
@ -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}.
|
||||
@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})
|
||||
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
|
||||
|
|
|
@ -65,11 +65,9 @@ static tree split_tree PARAMS ((tree, enum tree_code, tree *, tree *,
|
|||
int));
|
||||
static tree associate_trees PARAMS ((tree, tree, enum tree_code, tree));
|
||||
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 hashval_t size_htab_hash PARAMS ((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 enum tree_code invert_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)
|
|||
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
|
||||
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.
|
||||
|
@ -1247,9 +1219,8 @@ const_binop (code, arg1, arg2, notrunc)
|
|||
{
|
||||
REAL_VALUE_TYPE d1;
|
||||
REAL_VALUE_TYPE d2;
|
||||
int overflow = 0;
|
||||
REAL_VALUE_TYPE value;
|
||||
tree t;
|
||||
struct cb_args args;
|
||||
|
||||
d1 = TREE_REAL_CST (arg1);
|
||||
d2 = TREE_REAL_CST (arg2);
|
||||
|
@ -1261,24 +1232,14 @@ const_binop (code, arg1, arg2, notrunc)
|
|||
else if (REAL_VALUE_ISNAN (d2))
|
||||
return arg2;
|
||||
|
||||
/* Setup input for const_binop_1() */
|
||||
args.type = TREE_TYPE (arg1);
|
||||
args.d1 = d1;
|
||||
args.d2 = d2;
|
||||
args.code = code;
|
||||
REAL_ARITHMETIC (value, code, d1, d2);
|
||||
|
||||
if (do_float_handler (const_binop_1, (PTR) &args))
|
||||
/* Receive output from const_binop_1. */
|
||||
t = args.t;
|
||||
else
|
||||
{
|
||||
/* We got an exception from const_binop_1. */
|
||||
t = copy_node (arg1);
|
||||
overflow = 1;
|
||||
}
|
||||
t = build_real (TREE_TYPE (arg1),
|
||||
real_value_truncate (TYPE_MODE (TREE_TYPE (arg1)),
|
||||
value));
|
||||
|
||||
TREE_OVERFLOW (t)
|
||||
= (force_fit_type (t, overflow)
|
||||
= (force_fit_type (t, 0)
|
||||
| TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2));
|
||||
TREE_CONSTANT_OVERFLOW (t)
|
||||
= TREE_OVERFLOW (t)
|
||||
|
@ -1530,27 +1491,6 @@ size_diffop (arg0, arg1)
|
|||
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,
|
||||
return a constant tree representing the result of conversion. */
|
||||
|
@ -1650,8 +1590,6 @@ fold_convert (t, arg1)
|
|||
return build_real_from_int_cst (type, arg1);
|
||||
if (TREE_CODE (arg1) == REAL_CST)
|
||||
{
|
||||
struct fc_args args;
|
||||
|
||||
if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1)))
|
||||
{
|
||||
t = arg1;
|
||||
|
@ -1659,24 +1597,12 @@ fold_convert (t, arg1)
|
|||
return t;
|
||||
}
|
||||
|
||||
/* Setup input for fold_convert_1() */
|
||||
args.arg1 = arg1;
|
||||
args.type = type;
|
||||
|
||||
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);
|
||||
}
|
||||
t = build_real (type,
|
||||
real_value_truncate (TYPE_MODE (type),
|
||||
TREE_REAL_CST (arg1)));
|
||||
|
||||
TREE_OVERFLOW (t)
|
||||
= TREE_OVERFLOW (arg1) | force_fit_type (t, overflow);
|
||||
= TREE_OVERFLOW (arg1) | force_fit_type (t, 0);
|
||||
TREE_CONSTANT_OVERFLOW (t)
|
||||
= TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1);
|
||||
return t;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
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>
|
||||
|
||||
Fix for PR java/5368:
|
||||
|
@ -32,10 +38,10 @@
|
|||
|
||||
2002-03-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
|
||||
|
||||
* gcj.texi: @code{gcj} becomes @command{gcj}.
|
||||
@code{gcc} becomes @command{gcc}.
|
||||
GcjRaw changed to gnu.gcc.RawData.
|
||||
|
||||
* gcj.texi: @code{gcj} becomes @command{gcj}.
|
||||
@code{gcc} becomes @command{gcc}.
|
||||
GcjRaw changed to gnu.gcc.RawData.
|
||||
|
||||
2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* decl.c (start_java_method): Use new hook.
|
||||
|
@ -257,18 +263,18 @@
|
|||
|
||||
2002-02-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
|
||||
|
||||
* gcj.texi: Option `--classpath' becomes `--CLASSPATH.'Option
|
||||
`--CLASSPATH' becomes `--classpath.'
|
||||
* gjavah.c: Likewise.
|
||||
* jcf-dump.c: Likewise.
|
||||
* lang-options.h: Likewise.
|
||||
* lang.c: Likewise.
|
||||
* jcf-path.c: Updated comment.
|
||||
(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_path_CLASSPATH_arg): Ditto.
|
||||
(classpath_u): Updated leading comment.
|
||||
* gcj.texi: Option `--classpath' becomes `--CLASSPATH.'Option
|
||||
`--CLASSPATH' becomes `--classpath.'
|
||||
* gjavah.c: Likewise.
|
||||
* jcf-dump.c: Likewise.
|
||||
* lang-options.h: Likewise.
|
||||
* lang.c: Likewise.
|
||||
* jcf-path.c: Updated comment.
|
||||
(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_path_CLASSPATH_arg): Ditto.
|
||||
(classpath_u): Updated leading comment.
|
||||
|
||||
2002-02-20 Per Bothner <per@bothner.com>
|
||||
|
||||
|
@ -352,7 +358,7 @@
|
|||
current_function_decl before building JNI stub.
|
||||
|
||||
2002-01-26 Andreas Tobler <a.tobler@schweiz.ch>
|
||||
|
||||
|
||||
* gcc/java/builtins.c (sqrt_builtin): Use BUILT_IN_SQRT, not
|
||||
BUILT_IN_SQRTF.
|
||||
|
||||
|
|
|
@ -828,38 +828,33 @@ java_parse_escape_sequence ()
|
|||
}
|
||||
}
|
||||
|
||||
/* Isolate the code which may raise an arithmetic exception in its
|
||||
own function. */
|
||||
|
||||
#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)
|
||||
|
||||
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
|
||||
java_perform_atof (av)
|
||||
PTR av;
|
||||
java_perform_atof (java_lval, literal_token, fflag, number_beginning)
|
||||
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;
|
||||
tree type = (a->fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
|
||||
tree type = (fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
|
||||
|
||||
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))
|
||||
{
|
||||
JAVA_FLOAT_RANGE_ERROR ((a->fflag ? "float" : "double"));
|
||||
JAVA_FLOAT_RANGE_ERROR (fflag ? "float" : "double");
|
||||
value = DCONST0;
|
||||
}
|
||||
else if (IS_ZERO (value))
|
||||
|
@ -867,7 +862,7 @@ java_perform_atof (av)
|
|||
/* 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. */
|
||||
int really_zero = 1;
|
||||
char *p = a->literal_token;
|
||||
char *p = literal_token;
|
||||
if (*p == '-')
|
||||
++p;
|
||||
while (*p && *p != 'e' && *p != 'E')
|
||||
|
@ -1161,9 +1156,6 @@ java_lex (java_lval)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef JC1_LITE
|
||||
struct jpa_args a;
|
||||
#endif
|
||||
if (stage != 4) /* Don't push back fF/dD. */
|
||||
java_unget_unicode ();
|
||||
|
||||
|
@ -1176,17 +1168,10 @@ java_lex (java_lval)
|
|||
JAVA_LEX_LIT (literal_token, radix);
|
||||
|
||||
#ifndef JC1_LITE
|
||||
a.literal_token = literal_token;
|
||||
a.fflag = fflag;
|
||||
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;
|
||||
java_perform_atof (java_lval, literal_token,
|
||||
fflag, number_beginning);
|
||||
#endif
|
||||
return FP_LIT_TK;
|
||||
}
|
||||
}
|
||||
} /* JAVA_ASCII_FPCHAR (c) */
|
||||
|
|
|
@ -1065,11 +1065,8 @@ __floatdidf (DWtype u)
|
|||
#define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
|
||||
#define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
|
||||
#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 DF_SIZE DBL_MANT_DIG
|
||||
#define SF_SIZE FLT_MANT_DIG
|
||||
|
||||
|
|
|
@ -161,6 +161,10 @@ extern REAL_VALUE_TYPE real_value_truncate PARAMS ((enum machine_mode,
|
|||
|
||||
#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. */
|
||||
#define REAL_VALUE_ISINF(x) (target_isinf (x))
|
||||
|
||||
|
|
|
@ -101,11 +101,6 @@ static int simplify_plus_minus_op_data_cmp PARAMS ((const void *,
|
|||
static rtx simplify_plus_minus PARAMS ((enum rtx_code,
|
||||
enum machine_mode, rtx,
|
||||
rtx, int));
|
||||
static void check_fold_consts PARAMS ((PTR));
|
||||
static void simplify_unary_real PARAMS ((PTR));
|
||||
static void simplify_binary_real PARAMS ((PTR));
|
||||
static void simplify_binary_is2orm1 PARAMS ((PTR));
|
||||
|
||||
|
||||
/* Negate a CONST_INT rtx, truncating (because a conversion from a
|
||||
maximally negative number can overflow). */
|
||||
|
@ -341,65 +336,6 @@ simplify_replace_rtx (x, old, new)
|
|||
return x;
|
||||
}
|
||||
|
||||
/* Subroutine of simplify_unary_operation, called via do_float_handler.
|
||||
Handles simplification of unary ops on floating point values. */
|
||||
struct simplify_unary_real_args
|
||||
{
|
||||
rtx operand;
|
||||
rtx result;
|
||||
enum machine_mode mode;
|
||||
enum rtx_code code;
|
||||
bool want_integer;
|
||||
};
|
||||
#define REAL_VALUE_ABS(d_) \
|
||||
(REAL_VALUE_NEGATIVE (d_) ? REAL_VALUE_NEGATE (d_) : (d_))
|
||||
|
||||
static void
|
||||
simplify_unary_real (p)
|
||||
PTR p;
|
||||
{
|
||||
REAL_VALUE_TYPE d;
|
||||
|
||||
struct simplify_unary_real_args *args =
|
||||
(struct simplify_unary_real_args *) p;
|
||||
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d, args->operand);
|
||||
|
||||
if (args->want_integer)
|
||||
{
|
||||
HOST_WIDE_INT i;
|
||||
|
||||
switch (args->code)
|
||||
{
|
||||
case FIX: i = REAL_VALUE_FIX (d); break;
|
||||
case UNSIGNED_FIX: i = REAL_VALUE_UNSIGNED_FIX (d); break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
args->result = gen_int_mode (i, args->mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (args->code)
|
||||
{
|
||||
case SQRT:
|
||||
/* We don't attempt to optimize this. */
|
||||
args->result = 0;
|
||||
return;
|
||||
|
||||
case ABS: d = REAL_VALUE_ABS (d); break;
|
||||
case NEG: d = REAL_VALUE_NEGATE (d); break;
|
||||
case FLOAT_TRUNCATE: d = real_value_truncate (args->mode, d); break;
|
||||
case FLOAT_EXTEND: /* All this does is change the mode. */ break;
|
||||
case FIX: d = REAL_VALUE_RNDZINT (d); break;
|
||||
case UNSIGNED_FIX: d = REAL_VALUE_UNSIGNED_RNDZINT (d); break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
args->result = CONST_DOUBLE_FROM_REAL_VALUE (d, args->mode);
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to simplify a unary operation CODE whose output mode is to be
|
||||
MODE with input operand OP whose mode was originally OP_MODE.
|
||||
Return zero if no simplification can be made. */
|
||||
|
@ -638,16 +574,25 @@ simplify_unary_operation (code, mode, op, op_mode)
|
|||
else if (GET_CODE (trueop) == CONST_DOUBLE
|
||||
&& GET_MODE_CLASS (mode) == MODE_FLOAT)
|
||||
{
|
||||
struct simplify_unary_real_args args;
|
||||
args.operand = trueop;
|
||||
args.mode = mode;
|
||||
args.code = code;
|
||||
args.want_integer = false;
|
||||
REAL_VALUE_TYPE d;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d, trueop);
|
||||
|
||||
if (do_float_handler (simplify_unary_real, (PTR) &args))
|
||||
return args.result;
|
||||
switch (code)
|
||||
{
|
||||
case SQRT:
|
||||
/* We don't attempt to optimize this. */
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
case ABS: d = REAL_VALUE_ABS (d); break;
|
||||
case NEG: d = REAL_VALUE_NEGATE (d); break;
|
||||
case FLOAT_TRUNCATE: d = real_value_truncate (mode, d); break;
|
||||
case FLOAT_EXTEND: /* All this does is change the mode. */ break;
|
||||
case FIX: d = REAL_VALUE_RNDZINT (d); break;
|
||||
case UNSIGNED_FIX: d = REAL_VALUE_UNSIGNED_RNDZINT (d); break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
|
||||
}
|
||||
|
||||
else if (GET_CODE (trueop) == CONST_DOUBLE
|
||||
|
@ -655,16 +600,17 @@ simplify_unary_operation (code, mode, op, op_mode)
|
|||
&& GET_MODE_CLASS (mode) == MODE_INT
|
||||
&& width <= HOST_BITS_PER_WIDE_INT && width > 0)
|
||||
{
|
||||
struct simplify_unary_real_args args;
|
||||
args.operand = trueop;
|
||||
args.mode = mode;
|
||||
args.code = code;
|
||||
args.want_integer = true;
|
||||
|
||||
if (do_float_handler (simplify_unary_real, (PTR) &args))
|
||||
return args.result;
|
||||
|
||||
return 0;
|
||||
HOST_WIDE_INT i;
|
||||
REAL_VALUE_TYPE d;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d, trueop);
|
||||
switch (code)
|
||||
{
|
||||
case FIX: i = REAL_VALUE_FIX (d); break;
|
||||
case UNSIGNED_FIX: i = REAL_VALUE_UNSIGNED_FIX (d); break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return gen_int_mode (i, mode);
|
||||
}
|
||||
|
||||
/* This was formerly used only for non-IEEE float.
|
||||
|
@ -740,64 +686,6 @@ simplify_unary_operation (code, mode, op, op_mode)
|
|||
}
|
||||
}
|
||||
|
||||
/* Subroutine of simplify_binary_operation, called via do_float_handler.
|
||||
Handles simplification of binary ops on floating point values. */
|
||||
struct simplify_binary_real_args
|
||||
{
|
||||
rtx trueop0, trueop1;
|
||||
rtx result;
|
||||
enum rtx_code code;
|
||||
enum machine_mode mode;
|
||||
};
|
||||
|
||||
static void
|
||||
simplify_binary_real (p)
|
||||
PTR p;
|
||||
{
|
||||
REAL_VALUE_TYPE f0, f1, value;
|
||||
struct simplify_binary_real_args *args =
|
||||
(struct simplify_binary_real_args *) p;
|
||||
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (f0, args->trueop0);
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (f1, args->trueop1);
|
||||
f0 = real_value_truncate (args->mode, f0);
|
||||
f1 = real_value_truncate (args->mode, f1);
|
||||
|
||||
if (args->code == DIV
|
||||
&& !MODE_HAS_INFINITIES (args->mode)
|
||||
&& REAL_VALUES_EQUAL (f1, dconst0))
|
||||
{
|
||||
args->result = 0;
|
||||
return;
|
||||
}
|
||||
REAL_ARITHMETIC (value, rtx_to_tree_code (args->code), f0, f1);
|
||||
|
||||
value = real_value_truncate (args->mode, value);
|
||||
args->result = CONST_DOUBLE_FROM_REAL_VALUE (value, args->mode);
|
||||
}
|
||||
|
||||
/* Another subroutine called via do_float_handler. This one tests
|
||||
the floating point value given against 2. and -1. */
|
||||
struct simplify_binary_is2orm1_args
|
||||
{
|
||||
rtx value;
|
||||
bool is_2;
|
||||
bool is_m1;
|
||||
};
|
||||
|
||||
static void
|
||||
simplify_binary_is2orm1 (p)
|
||||
PTR p;
|
||||
{
|
||||
REAL_VALUE_TYPE d;
|
||||
struct simplify_binary_is2orm1_args *args =
|
||||
(struct simplify_binary_is2orm1_args *) p;
|
||||
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d, args->value);
|
||||
args->is_2 = REAL_VALUES_EQUAL (d, dconst2);
|
||||
args->is_m1 = REAL_VALUES_EQUAL (d, dconstm1);
|
||||
}
|
||||
|
||||
/* Simplify a binary operation CODE with result mode MODE, operating on OP0
|
||||
and OP1. Return 0 if no simplification is possible.
|
||||
|
||||
|
@ -837,15 +725,22 @@ simplify_binary_operation (code, mode, op0, op1)
|
|||
&& GET_CODE (trueop1) == CONST_DOUBLE
|
||||
&& mode == GET_MODE (op0) && mode == GET_MODE (op1))
|
||||
{
|
||||
struct simplify_binary_real_args args;
|
||||
args.trueop0 = trueop0;
|
||||
args.trueop1 = trueop1;
|
||||
args.mode = mode;
|
||||
args.code = code;
|
||||
REAL_VALUE_TYPE f0, f1, value;
|
||||
|
||||
if (do_float_handler (simplify_binary_real, (PTR) &args))
|
||||
return args.result;
|
||||
return 0;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (f0, trueop0);
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (f1, trueop1);
|
||||
f0 = real_value_truncate (mode, f0);
|
||||
f1 = real_value_truncate (mode, f1);
|
||||
|
||||
if (code == DIV
|
||||
&& !MODE_HAS_INFINITIES (mode)
|
||||
&& REAL_VALUES_EQUAL (f1, dconst0))
|
||||
return 0;
|
||||
|
||||
REAL_ARITHMETIC (value, rtx_to_tree_code (code), f0, f1);
|
||||
|
||||
value = real_value_truncate (mode, value);
|
||||
return CONST_DOUBLE_FROM_REAL_VALUE (value, mode);
|
||||
}
|
||||
|
||||
/* We can fold some multi-word operations. */
|
||||
|
@ -1276,20 +1171,18 @@ simplify_binary_operation (code, mode, op0, op1)
|
|||
&& ! rtx_equal_function_value_matters)
|
||||
return gen_rtx_ASHIFT (mode, op0, GEN_INT (val));
|
||||
|
||||
/* x*2 is x+x and x*(-1) is -x */
|
||||
if (GET_CODE (trueop1) == CONST_DOUBLE
|
||||
&& GET_MODE_CLASS (GET_MODE (trueop1)) == MODE_FLOAT)
|
||||
&& GET_MODE_CLASS (GET_MODE (trueop1)) == MODE_FLOAT
|
||||
&& GET_MODE (op0) == mode)
|
||||
{
|
||||
struct simplify_binary_is2orm1_args args;
|
||||
REAL_VALUE_TYPE d;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d, trueop1);
|
||||
|
||||
args.value = trueop1;
|
||||
if (! do_float_handler (simplify_binary_is2orm1, (PTR) &args))
|
||||
return 0;
|
||||
|
||||
/* x*2 is x+x and x*(-1) is -x */
|
||||
if (args.is_2 && GET_MODE (op0) == mode)
|
||||
if (REAL_VALUES_EQUAL (d, dconst2))
|
||||
return gen_rtx_PLUS (mode, op0, copy_rtx (op0));
|
||||
|
||||
else if (args.is_m1 && GET_MODE (op0) == mode)
|
||||
if (REAL_VALUES_EQUAL (d, dconstm1))
|
||||
return gen_rtx_NEG (mode, op0);
|
||||
}
|
||||
break;
|
||||
|
@ -1923,35 +1816,6 @@ simplify_plus_minus (code, mode, op0, op1, force)
|
|||
return negate ? gen_rtx_NEG (mode, result) : result;
|
||||
}
|
||||
|
||||
struct cfc_args
|
||||
{
|
||||
rtx op0, op1; /* Input */
|
||||
int equal, op0lt, op1lt; /* Output */
|
||||
int unordered;
|
||||
};
|
||||
|
||||
static void
|
||||
check_fold_consts (data)
|
||||
PTR data;
|
||||
{
|
||||
struct cfc_args *args = (struct cfc_args *) data;
|
||||
REAL_VALUE_TYPE d0, d1;
|
||||
|
||||
/* We may possibly raise an exception while reading the value. */
|
||||
args->unordered = 1;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d0, args->op0);
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d1, args->op1);
|
||||
|
||||
/* Comparisons of Inf versus Inf are ordered. */
|
||||
if (REAL_VALUE_ISNAN (d0)
|
||||
|| REAL_VALUE_ISNAN (d1))
|
||||
return;
|
||||
args->equal = REAL_VALUES_EQUAL (d0, d1);
|
||||
args->op0lt = REAL_VALUES_LESS (d0, d1);
|
||||
args->op1lt = REAL_VALUES_LESS (d1, d0);
|
||||
args->unordered = 0;
|
||||
}
|
||||
|
||||
/* Like simplify_binary_operation except used for relational operators.
|
||||
MODE is the mode of the operands, not that of the result. If MODE
|
||||
is VOIDmode, both operands must also be VOIDmode and we compare the
|
||||
|
@ -2035,17 +1899,13 @@ simplify_relational_operation (code, mode, op0, op1)
|
|||
&& GET_CODE (trueop1) == CONST_DOUBLE
|
||||
&& GET_MODE_CLASS (GET_MODE (trueop0)) == MODE_FLOAT)
|
||||
{
|
||||
struct cfc_args args;
|
||||
REAL_VALUE_TYPE d0, d1;
|
||||
|
||||
/* Setup input for check_fold_consts() */
|
||||
args.op0 = trueop0;
|
||||
args.op1 = trueop1;
|
||||
|
||||
|
||||
if (!do_float_handler (check_fold_consts, (PTR) &args))
|
||||
args.unordered = 1;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d0, trueop0);
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d1, trueop1);
|
||||
|
||||
if (args.unordered)
|
||||
/* Comparisons are unordered iff at least one of the values is NaN. */
|
||||
if (REAL_VALUE_ISNAN (d0) || REAL_VALUE_ISNAN (d1))
|
||||
switch (code)
|
||||
{
|
||||
case UNEQ:
|
||||
|
@ -2068,10 +1928,9 @@ simplify_relational_operation (code, mode, op0, op1)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Receive output from check_fold_consts() */
|
||||
equal = args.equal;
|
||||
op0lt = op0ltu = args.op0lt;
|
||||
op1lt = op1ltu = args.op1lt;
|
||||
equal = REAL_VALUES_EQUAL (d0, d1);
|
||||
op0lt = op0ltu = REAL_VALUES_LESS (d0, d1);
|
||||
op1lt = op1ltu = REAL_VALUES_LESS (d1, d0);
|
||||
}
|
||||
|
||||
/* Otherwise, see if the operands are both integers. */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
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>
|
||||
|
||||
* g++.old-deja/g++.jason/thunk3.C: Add xtensa-*-* to list of
|
||||
|
@ -62,7 +66,7 @@
|
|||
|
||||
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>
|
||||
|
||||
|
@ -74,13 +78,13 @@
|
|||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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)
|
|||
|
||||
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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
* 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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
* 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>
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
|
||||
|
||||
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" } */
|
||||
/* { 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" } */
|
||||
/* { dg-error "too many decimal points" "bad hex float" { target *-*-* } 10 } */
|
||||
|
|
77
gcc/toplev.c
77
gcc/toplev.c
|
@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
#undef FFS /* Some systems define this in param.h. */
|
||||
#include "system.h"
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h>
|
||||
|
@ -109,9 +108,7 @@ static void finalize PARAMS ((void));
|
|||
|
||||
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 set_float_handler PARAMS ((jmp_buf));
|
||||
static void compile_file PARAMS ((void));
|
||||
static void display_help PARAMS ((void));
|
||||
static void display_target_options PARAMS ((void));
|
||||
|
@ -1626,73 +1623,6 @@ floor_log2_wide (x)
|
|||
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
|
||||
into ICE messages, which is much more user friendly. */
|
||||
|
||||
|
@ -4565,10 +4495,6 @@ general_init (argv0)
|
|||
|
||||
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. */
|
||||
#ifdef SIGSEGV
|
||||
signal (SIGSEGV, crash_signal);
|
||||
|
@ -4585,6 +4511,9 @@ general_init (argv0)
|
|||
#if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
|
||||
signal (SIGIOT, crash_signal);
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
signal (SIGFPE, crash_signal);
|
||||
#endif
|
||||
|
||||
/* Initialize the diagnostics reporting machinery, so option parsing
|
||||
can give warnings and errors. */
|
||||
|
|
|
@ -88,7 +88,6 @@ extern void error_for_asm PARAMS ((struct rtx_def *,
|
|||
extern void warning_for_asm PARAMS ((struct rtx_def *,
|
||||
const char *, ...));
|
||||
extern void warn_deprecated_use PARAMS ((union tree_node *));
|
||||
extern int do_float_handler PARAMS ((void (*) (PTR), PTR));
|
||||
|
||||
#ifdef BUFSIZ
|
||||
extern void output_quoted_string PARAMS ((FILE *, const char *));
|
||||
|
|
42
gcc/tree.c
42
gcc/tree.c
|
@ -122,7 +122,6 @@ struct type_hash
|
|||
|
||||
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 append_random_chars PARAMS ((char *));
|
||||
static int type_hash_eq PARAMS ((const void*, const void*));
|
||||
|
@ -591,31 +590,8 @@ real_value_from_int_cst (type, i)
|
|||
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
|
||||
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. */
|
||||
representing the same value as a floating-point constant of type TYPE. */
|
||||
|
||||
tree
|
||||
build_real_from_int_cst (type, i)
|
||||
|
@ -625,27 +601,13 @@ build_real_from_int_cst (type, i)
|
|||
tree v;
|
||||
int overflow = TREE_OVERFLOW (i);
|
||||
REAL_VALUE_TYPE d;
|
||||
struct brfic_args args;
|
||||
|
||||
v = make_node (REAL_CST);
|
||||
TREE_TYPE (v) = type;
|
||||
|
||||
/* Setup input for build_real_from_int_cst_1() */
|
||||
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;
|
||||
}
|
||||
d = real_value_from_int_cst (type, i);
|
||||
|
||||
/* Check for valid float value for this type on this target machine. */
|
||||
|
||||
#ifdef CHECK_FLOAT_VALUE
|
||||
CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
|
||||
#endif
|
||||
|
|
|
@ -33,8 +33,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
#define HAVE_DECL_GETOPT 1
|
||||
#endif
|
||||
|
||||
/* GCC supplies this header. */
|
||||
/* GCC supplies these headers. */
|
||||
#include <stddef.h>
|
||||
#include <float.h>
|
||||
|
||||
#ifdef inhibit_libc
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue